RosettaCodeData/Task/Arithmetic-Integer/Crystal/arithmetic-integer.crystal

11 lines
409 B
Plaintext

a = gets.not_nil!.to_i64
b = gets.not_nil!.to_i64
puts "Sum: #{a + b}"
puts "Difference: #{a - b}"
puts "Product: #{a * b}"
puts "Quotient (float division): #{a / b}" # / always returns a float.
puts "Quotient (floor division): #{a // b}"
puts "Remainder: #{a % b}" # Sign of remainder matches that of the second operand (b).
puts "Power: #{a ** b}" # Integers can only be raised to a positive exponent.