How 1.25 % 0.5 >>> 0.25 🙁🙁 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How 1.25 % 0.5 >>> 0.25 🙁🙁

3rd Jun 2019, 5:36 PM
Hossein Ghobadi
Hossein Ghobadi - avatar
3 Answers
+ 2
1.25 = 0.5 * 2 + 0.25 ^^^^ remainder
3rd Jun 2019, 5:54 PM
Farry
Farry - avatar
0
% is division reminder,then 1.25 % 0.5 = 1 and 1.25 - 1 = 0.25
3rd Jun 2019, 5:44 PM
CodeFu
CodeFu - avatar
0
The modulus operator returns the remainder of the quotient: since 0.5 can go into 1.25 (evenly) twice, the remainder of 0.25 is the returned value.
3rd Jun 2019, 5:59 PM
ScriptNasty
ScriptNasty - avatar