+ 5
Why we are used modulus only for integer ?and not for float?
for solving reminder
2 odpowiedzi
0
because a modulus simply does this
10 % 3
(10>3) 10-3=3
(7>3) 7-3=4
(4>3) 4-3=1
(1<3) 10%3=1
so unless you really need to use modulus on a decimal precision, you dont need it for int's
0
Because you don't have a remainder when when dividing with floats - at least when you want your result to be float, too.