Sha256: 8005717928c80379de84028abb08ffae0d4c6bcfdebcc4e77ea8e1e7118bdbd4

Contents?: true

Size: 362 Bytes

Versions: 10

Compression:

Stored size: 362 Bytes

Contents

puts 'Enter x and y'
x = gets.to_i  # to check errors, use x=Integer(gets)
y = gets.to_i

puts "Sum: #{x+y}",
     "Difference: #{x-y}",
     "Product: #{x*y}",
     "Quotient: #{x/y}",       # truncates towards negative infinity
     "Quotient: #{x.fdiv(y)}", # float
     "Remainder: #{x%y}",      # same sign as second operand
     "Exponentiation: #{x**y}"

Version data entries

10 entries across 7 versions & 1 rubygems

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