I’m trying to get the remainder of a division using Ruby.
Let’s say we’re trying to divide 208 by 11.
The final should be “18 with a remainder of 10″…what I ultimately need is that 10.
Here’s what I’ve got so far, but it chokes in this use case (saying the remainder is 0).
division = 208.to_f / 11
rounded = (division*10).ceil/10.0
remainder = rounded.round(1).to_s.last.to_i
The modulo operator: