Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Arithmetic-Integer/Ruby/arithmetic-integer.rb
Normal file
12
Task/Arithmetic-Integer/Ruby/arithmetic-integer.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
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}",
|
||||
"Quotient: %d with Remainder: %d" % x.divmod(y)
|
||||
Loading…
Add table
Add a link
Reference in a new issue