Modulo in order of operation
Solution 1:
This depends on the language, but in C style languages %
is the same precedence as *
and /
. This means that if it appears in the same expression (without parentheses) the order depends on the associativity. In this case %
is usually left-associative, so the operators will be executed in left-to-right order.
Solution 2:
The relative precedence levels of operators found in many C-style languages are as follows:
Wikipedia - Order of Operations
Solution 3:
At least in C++ and Java, modulo (%
) has the same level of precedence as multiplication and division.
Since %
, /
and *
are (usually) left-associative, they are evaluated left to right.
(Thanks to Mark for pointing out operator associativity)
Solution 4:
If your question is about programming languages then yes, % has the same order as * and /
See this table.
Solution 5:
The modulo operator %, as used in many computer programming languages, is not common in pure mathematics. So it is rather a question of how the operator is treated in programming languages, and this differ between different langauges.