jkaihsu
3/7/2013 - 8:13 AM

Define four methods which correspond to the four basic arithmetic operations: add, subtract, multiply, divide.They should accept either inte

Define four methods which correspond to the four basic arithmetic operations: add, subtract, multiply, divide.They should accept either integers or floating point numbers as input. divide should perform floating point division.

def add(x,y)
  x + y
end

def subtract(x,y)
  x - y
end

def multiply(x,y)
  x * y
end

def divide(x,y)
 x.to_f / y.to_f
end