Jump to content

Arithmetic/Integer: Difference between revisions

Line 303:
 
Serves 5.</lang>
 
=={{header|Clojure}}==
<lang clojure>(defn myfunc []
(println "Enter x and y")
(let [x (read), y (read)]
(doseq [op '(+ - * / Math/pow rem)]
(let [exp (list op x y)]
(printf "%s=%s\n" exp (eval exp))))))</lang>
 
<pre>user=> (myfunc)
Enter x and y
3
6
(+ 3 6)=9
(- 3 6)=-3
(* 3 6)=18
(/ 3 6)=1/2
(Math/pow 3 6)=729.0
(rem 3 6)=3
nil</pre>
 
=={{header|Common Lisp}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.