
Patrick B. answered 12/05/20
Math and computer tutor/teacher
There is a problem... which operator has higher
precedence: the mod or the addition? In many systems,
the mod operator has equal precedence to multiplication
and division but higher precedence than addition
and subtraction because it is a division operation.
(a) mod calculated before addition....
-133 / 23 = -6 r 5 so -133 mod 23 = 5
270/23 = 11 r 17 so 270 mod 23 = 17
5+17=22
22 mod 23 = 22 <--- final answer
(b) all have equal precedence, so done left to right...
177 mod 31 = 22
22 * 270 = 5940
5940 mod 31 = 19
finally 19 mod 31 = 19
(c) exponents have higher proirity than mod per PEMDAS:
89^3 = 704969
704969 mod 79 = 52
52^4 = 7311616
7311616 mod 26 = 281216 with no remainder!
so the final answer is ZER0!