+ 3
Modulus
can anyone help me with this concept of modulus% I don't understand please help.
5 Answers
+ 7
So lemme explain with 47%6.
Note that 6*7+5=47.
Hence 47/6 leaves a remaimder of 5, or 47%6=5
+ 6
See the chocolaty example :D
https://www.sololearn.com/Discuss/701356/i-am-confusing-in-quotient-and-remainder-topic-so-can-u-elobrate-it
+ 5
forget about floating point numbers for a moment and go back to elementary school where you calculated division like this:
how often does 2 fit in 5?
it fits in there 2 times leaving a remainder of 1 (2*2 = 4 -> 5-4 = 1)
This remainder is what modulo calculates. Whatever is left in an integer division.
+ 4
it just gives you the remainder
+ 1
This code will help you to fully understed how modulus works:
https://code.sololearn.com/Wcy7iV5Ln1ly/?ref=app