Sha256: 4d12d0254e2a321842f72224640a24c0f0583422ef4268fc5c729ea2fdad2e6a

Contents?: true

Size: 410 Bytes

Versions: 10

Compression:

Stored size: 410 Bytes

Contents

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.

Version data entries

10 entries across 7 versions & 1 rubygems

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