+ 1
Can someone describe what the modulus operator is, I don't understand it.
none
6 Answers
+ 14
As long as you know what division is... you know what modulus (modulo reduction) is. Think of it like this...
11 divided by 5 is 2, with a remainder of 1. (5 * 2 + 1 = 11)
or..
13 divided by 7 is 1, with a remainder of 6. (7 * 1 + 6 = 13)
basically, just divide the numbers wherever you see the modulus operator, and the remainder will be the answer.
+ 11
5 divided by 2 results in 2 with remainder of 1.
You can read 5 % 2 as five modulus 2, or the remainder when 5 is divided by two.
Hence,
5 modulus 2 is 1.
More examples:
5%3 = 2
11%5 = 1
12%11 = 1
1%2 = 1
+ 2
Modulus cannot be greater than the divisor
+ 1
Is what's left on a division, also called reminder
For example 15/15 = 1 (Modulo 0)
Another example is 5/3 = 1.6 (modulo 2)
6/3 = 2 (Modulo= 0)
+ 1
Thank you. Makes so much sense now. I got caught up with the percent sign.
0
Modulo is the remainder.