+ 5
1.25%0.5 = 0.25 HOW?
5 odpowiedzi
+ 20
How modulos work is they take the division of the two operands, then return the remainder. In this example, 0.5 can fully go into 1.25 2 times without going over, leaving a remainder of 0.25 (0.5 * 2 = 1, 1.25 - 1 = 0.25)
Hope this cleared that up!
+ 4
tnx faisal
+ 2
1.25 - 2 * 0.5 = 0.25
+ 1
The operator used i.e "%" simply gives us the remainder of the two numbers. Divide 1.25 with 0.5 and the remainder is 0.25.
p.s.: Do it manually if still not understood xp
0
2*0.5+0.25=1.25