Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Arithmetic-Integer/Standard-ML/arithmetic-integer.ml
Normal file
13
Task/Arithmetic-Integer/Standard-ML/arithmetic-integer.ml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
val () = let
|
||||
val a = valOf (Int.fromString (valOf (TextIO.inputLine TextIO.stdIn)))
|
||||
val b = valOf (Int.fromString (valOf (TextIO.inputLine TextIO.stdIn)))
|
||||
in
|
||||
print ("a + b = " ^ Int.toString (a + b) ^ "\n");
|
||||
print ("a - b = " ^ Int.toString (a - b) ^ "\n");
|
||||
print ("a * b = " ^ Int.toString (a * b) ^ "\n");
|
||||
print ("a div b = " ^ Int.toString (a div b) ^ "\n"); (* truncates towards negative infinity *)
|
||||
print ("a mod b = " ^ Int.toString (a mod b) ^ "\n"); (* same sign as second operand *)
|
||||
print ("a quot b = " ^ Int.toString (Int.quot (a, b)) ^ "\n");(* truncates towards 0 *)
|
||||
print ("a rem b = " ^ Int.toString (Int.rem (a, b)) ^ "\n"); (* same sign as first operand *)
|
||||
print ("~a = " ^ Int.toString (~a) ^ "\n") (* unary negation, unusual notation compared to other languages *)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue