I can't figure out how to do something very simple in my program.
Given a float value f
(it could be 0, or it could be 5 million, etc), I need to find the first value x
such x >= f
(x is greater than f) and x
is a multiple of 5.
I can't figure out how to do something very simple in my program.
Given a float value f
(it could be 0, or it could be 5 million, etc), I need to find the first value x
such x >= f
(x is greater than f) and x
is a multiple of 5.
Divide by 5, round up to the next integer (using ceil()
or similar), multiply by 5 again.
You can use modulo operator and do something like:
x = f - f % 5 + 5