Division error!

When I try to make a division account for example 24/48 the result of 0

Does anyone know what can it be?

It’s integer division. Use to_f to make num1 a floating point, i.e. #{num1.to_f / num2}

@SecInfinity, You are converting to the Integer.
For the right result, convert it to a Float with to_f .

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs