Arithmetic/Integer: Difference between revisions

Line 372:
 
=={{header|F_Sharp|F#}}==
<lang fsharp>#light
do
[<EntryPoint>]
let a, b = int Sys.argv.[1], int Sys.argv.[2]
let main args =
for str, f in ["+", ( + ); "-", ( - ); "*", ( * ); "/", ( / ); "%", ( % )] do
if Array.length args <> 2 then
printfnprintf "a%d add%s b%d = %d\n" (a +str b (f a b)
eprintfn "usage: basic_arithmethic numA numB"
0</lang>
exit 0
let (j, a) = System.Int32.TryParse(args.[0])
let (k, b) = System.Int32.TryParse(args.[1])
printfn "a add b = %d" (a + b)
printfn "a subtract b = %d" (a - b)
printfn "a multiplied by b = %d" (a * b)
printfn "a divided by b = %d" (a / b)
printfn "a mod b = %d" (a % b)
0</lang>
 
=={{header|Groovy}}==
Anonymous user