Program to perform divison operation of two numbers without using /, %, and modules operator


def devide(divisor, dividend)
  quotient = 0
  until(dividend < divisor) do
    dividend -= divisor
    quotient += 1
  end
  quotient
end

puts devide(15, 100)

Comments

Popular posts from this blog

Rails Kaminari - Ajax pagination

Rails mongoid has field model validation

Rails Upgrading a project