Modulo in the Order of Operations Calculator

Your details

The number being divided. Can be negative.
The number to divide by (the modulus). Cannot be zero.
Truncated division: remainder has the same sign as the dividend. Floored division: remainder has the same sign as the divisor. Results differ only when inputs have opposite signs.
Remainder (a mod b)Has remainder
2

The remainder after integer division of a by b

Integer quotient3
Proof: quotient x divisor15
Proof: quotient x divisor + remainder17
Quotient x Divisor15
Remainder2
Total (= Dividend)17

17 mod 5 = 2

  • 17 divided by 5 leaves a remainder of 2.
  • The integer quotient is 3, meaning 5 fits into 17 exactly 3 times.
  • In an expression, modulo is evaluated at the same step as multiplication and division, left to right, before addition and subtraction.

Next stepSwitch the convention selector above to see how Python (floored) vs JavaScript (truncated) would handle this same pair.

= Powered by OnlyCalculators