+ 1

How i solve modulus?

I cannot understand 26%6=2

28th Dec 2016, 2:29 PM
Ashivani Sharma
Ashivani Sharma - avatar
4 odpowiedzi
+ 7
26%6 actually returns the remainder of 26/6. Likewise, 5/3 has remainder of 2 hence, 5%3 = 2.
28th Dec 2016, 2:37 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
26 divided by 6 equals 24 plus a reminder of 2. 26 modulus 6 will give you only the reminder: 2
28th Dec 2016, 3:41 PM
seamiki
seamiki - avatar
+ 1
thanks
28th Dec 2016, 4:07 PM
Ashivani Sharma
Ashivani Sharma - avatar
+ 1
See my "% Modulus explained" code to understand in a way, you may have learnt at school https://code.sololearn.com/c2fRl6x893E7/?ref=app
31st Dec 2016, 12:43 PM
Vishal++
Vishal++ - avatar