0
What does the modulus operator do?
english is not my native language, i understand almost everything, but not the modulus. Help!!!
7 Answers
+ 1
its like 12%5=2 because 5*2= 10, then it will rest 2, and this is the answer, 12%5=2 right?!
+ 1
thanks, you just teach me a new operator :P
0
It's a strange operator :
It returns the rest of a division :
12%5=2 // weird uh ?
2*5=10
12-10=2
another exemple :
5%2=1
2*2=4
5-4=1
Ask if you don't understand !
0
why the another example, it is 2*2 and not 2*1?
0
5%2 --> 5/2 how much 2 in 5, two because
2*2=4 4<5and 2*3=6. 6>5 2 is the 'quotient' (sorry I'm french X) )
Then to find the rest : 5-4=1
I don't know if it's ok, it's difficult to explain
If you still don't understand, I can try a code
0
ohhh now i completely understand, thanks a lot ^-^
0
Exactly !!