Please explain % | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please explain %

How does it give 1.5%0.5 = 0.25

4th Jun 2019, 6:23 PM
Himanshu Batra
Himanshu Batra - avatar
4 Answers
+ 2
% or modulus finds the remainder of an integer division. 0.5 is two times into 1.25, there will be a remainder of 1.25 - 2*0.5 = 0.25
4th Jun 2019, 6:50 PM
MsJ
MsJ - avatar
+ 1
Airree is right, 1.5%0.5 = 0 EDIT: if you typed wrong and you actually meant "1.25%0.5" then yes it's 0.25
4th Jun 2019, 7:09 PM
Mo Hani
Mo Hani - avatar
+ 1
% is division reminder!
4th Jun 2019, 8:54 PM
CodeFu
CodeFu - avatar
0
No, 1.5 % 0.5 isn't equal to 0.25, it's equal to 0
4th Jun 2019, 6:37 PM
Airree
Airree - avatar