Sha256: 3afcec643bbb2ed149875fa1de48d8b83843ef18f103ed33e17a48e8899bb763
Contents?: true
Size: 856 Bytes
Versions: 10
Compression:
Stored size: 856 Bytes
Contents
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
Version data entries
10 entries across 7 versions & 1 rubygems