zettacode.files/arithmetic.integer/ruby.txt in zettacode-0.1.0 vs zettacode.files/arithmetic.integer/ruby.txt in zettacode-0.1.1
- old
+ new
@@ -1,12 +1,12 @@
-u 'E d '
- = ._ # cc , u =I()
- = ._
+puts 'Enter x and y'
+x = gets.to_i # to check errors, use x=Integer(gets)
+y = gets.to_i
-u "Su: #{+}",
- "Dffc: #{-}",
- "Puc: #{*}",
- "Qu: #{}", # uc f
- "Qu: #{.f()}", # f
- "R: #{%}", # c
- "E: #{**}"
+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}"