Anonymous user
Arithmetic/Integer: Difference between revisions
added ReScript
m (→Node.JS) |
(added ReScript) |
||
Line 4,408:
echo "a^b = ".format(pow(a,b),"%1d")
</lang>
=={{header|ReScript}}==
<lang ReScript>let a = int_of_string(Sys.argv[2])
let b = int_of_string(Sys.argv[3])
let sum = a + b
let difference = a - b
let product = a * b
let division = a / b
let remainder = mod(a, b)
Js.log("a + b = " ++ string_of_int(sum))
Js.log("a - b = " ++ string_of_int(difference))
Js.log("a * b = " ++ string_of_int(product))
Js.log("a / b = " ++ string_of_int(division))
Js.log("a % b = " ++ string_of_int(remainder))</lang>
{{out}}
<pre>$ bsc arith.res > arith.bs.js
$ node arith.bs.js 10 7
a + b = 17
a - b = 3
a * b = 70
a / b = 1
a % b = 3
</pre>
=={{header|Retro}}==
|