Quotient and remainder

Check both the quotient and the remainder

Enter an integer dividend and a nonzero integer divisor. The result satisfies a=b×q+r, with 0≤r<abs(b), including when either input is negative.

This nonnegative-remainder convention is explicit. A truncating quotient or a programming language’s negative-divisor remainder can give a different pair. Verify the reconstruction and the remainder bounds together.

Worked example: −7 divided by 3

The pair is quotient −3 and remainder 2: 3×(−3)+2=−7, and 0≤2<3. A quotient of −2 would leave a negative remainder.

For 7 divided by −3, the pair is quotient −2 and remainder 1: (−3)×(−2)+1=7.

Load example fills the form without calculating. Choose its primary action to work it out.

Sources and related calculators

The method and worked example here are original. Sources describe the underlying mathematics or notation; calculation choices and limits are in the precision and syntax guide.