0
Why int x = 16 â° int y = 5 equal 1?
4 Answers
+ 4
The modulus operator (%) finds the remainder in an equation. So 16%5 is equal to 1
+ 2
16 divided by 5 is 3 with a remainder of 1. The modulus operator takes the remainder.
0
One way to find a remainder is like this. How high can you multiply 5 without going over 16? That would be 15, so subtract 15 from 16, and you get 1. The modulus (%) operator gives the remainder back.
0
Think it like 16 mod 5.
3x5=15, 4x5=20. So there is not an integer equal to 16.
If you divide 16 with 5 you have 16-15=1 which is the remainder.