0
I did not understand modulus operator. Please explain
I couldn't understand how the remainder is left behind and why % sign is used
3 Answers
0
Modulus is kinda like division but insted of giving you have many time something can be divided, it gives you "what is left" (the remainder) after the division.
4/2 = 2
4%2 = 0
4/3 = 1,333333......
4%3 = 1
15/7 = 2,1428.........
15%7 = 1
0
How come 4%2=0
What % represent ??
0
% is the "modulus" operator, just like + - / * Are operators, and the modulus calculation result is the the "remainder"
it works just like division.
but results in what is left aften the division
5/2 = 2.xxx
5%2 = 1
6/2 = 3
6%2 = 0
4/2 = 2
4%2 = 0