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

Version Path
zettacode-0.1.7 files.zettacode/arithmetic.integer/standard_ml.txt
zettacode-0.1.6 files.zettacode/arithmetic.integer/standard_ml.txt
zettacode-0.1.6 files.zettacode2/arithmetic.integer/standard_ml.txt
zettacode-0.1.5 files.zettacode/arithmetic.integer/standard_ml.txt
zettacode-0.1.5 files.zettacode2/arithmetic.integer/standard_ml.txt
zettacode-0.1.4 files.zettacode/arithmetic.integer/standard_ml.txt
zettacode-0.1.4 files.zettacode2/arithmetic.integer/standard_ml.txt
zettacode-0.1.3 files.zettacode/arithmetic.integer/standard_ml.txt
zettacode-0.1.2 files.zettacode/arithmetic.integer/standard_ml.txt
zettacode-0.1.1 zettacode.files/arithmetic.integer/standard_ml.txt