This might be an easy question for some... I understand mod when the number before the % sign is greater than the number after it eg, 25%10=5. However I don't understand when the number before the % is smaller than the number after it for eg... 3%26. Because in my text it says 3%26=3,whereas according to me it should be 2.Please help.
Asked
Active
Viewed 30 times
1 Answers
0
You can think of the operator as "find the remainder".
What happens when 26 % 3
? You get 3 * 8 = 24, which creates a remainder of 2.
In the case of 3 % 26
, 26 divides 3 exactly 0 times. 3 - 0 = 3, creating a remainder of 3.

aphrid
- 589
- 8
- 25
-
No problem! If this answer helped you out, could you please hit the checkmark to set it as the accepted answer? Many thanks! – aphrid Jan 08 '18 at 00:24