Arithmetic/Integer: Difference between revisions

→‎{{header|Ruby}}: Also do exponentiation.
m (→‎{{header|AWK}}: Also allow trailing space.)
(→‎{{header|Ruby}}: Also do exponentiation.)
Line 1,420:
 
<lang ruby>puts 'Enter x and y'
x=gets.to_i # to check errors, use x=Integer(gets, 10)
x=gets.to_i
y=gets.to_i
 
Line 1,426:
"Difference: #{x-y}",
"Product: #{x*y}",
"Quotient: #{x/y}", # truncates towards negative infinity
"Remainder: #{x%y}", # same sign as second operand</lang>
"Exponentiation: #{x**y}"</lang>
 
=={{header|Scala}}==
Anonymous user