Remainder Calculator

Work out the whole-number quotient and remainder of any two integers, negatives included, with the mod operation.

Your details

Your data stays in your browser

Result

Enter the dividend and divisor, then press “Calculate”.

Analysis and suggestions

Once calculated, this shows what your result means and suggestions based on your numbers.

Behind the result

Work out the whole-number quotient and remainder of any two integers, negatives included, with the mod operation.

Example · a = b × q + r، حيث 0 ≤ r < |b|

17 mod 5 = 2

How it is calculated

Comprehensive Calculator Guide

This calculator gives the integer quotient and remainder of any two integers, negatives included, in mod notation. 17 ÷ 5 = 3 remainder 2, so 17 mod 5 = 2. It also explains why −17 mod 5 is 3 in maths but −2 in JavaScript.

Remainders

For integers a and b ≠ 0 there are unique q and r with a = bq + r and 0 ≤ r < |b|. Languages like JavaScript, C and Java truncate toward zero and can return negative remainders; Python matches the maths.

How to Use

  1. Enter the dividend.
  2. Enter a non-zero divisor.
  3. Press “Calculate” to see the remainder, quotient and the programming remainder if different.

Formula Used

a = b × q + r, 0 ≤ r < |b|

Practical Examples

Example 1
17 ÷ 5 = 3 r 2.
Example 2
−17 ÷ 5: q = −4, r = 3 (JavaScript gives −2).
Example 3
100 ÷ 7 = 14 r 2.

Important Tips

  • Use mod 7 for weekdays.
  • Check: b × q + r = a.
  • Mind negatives in code.

Common Mistakes to Avoid

  • A remainder ≥ the divisor.
  • Expecting every language to agree on negatives.
  • Confusing remainder with decimals.

Frequently Asked Questions

What does 17 mod 5 mean?
The remainder, 2.
How do I find it by hand?
Subtract divisor × quotient from the dividend.
Why do programs differ?
They round the quotient differently.

Read Also

Results are estimates for educational purposes and may vary depending on your situation and data sources.