Operator % = Remainder
Description taken from wikipedia.
The remainder for natural numbers
If
a and
d are
natural numbers, with
d non-zero, it can be proved that there exist unique integers
q and
r, such that
a =
qd +
r and 0 ≤
r <
d. The number
q is called the
quotient, while
r is called the
remainder. The
division algorithm provides a proof of this result and also an algorithm describing how to calculate the remainder.
Examples
- When dividing 13 by 10, 1 is the quotient and 3 is the remainder, because 13=1×10+3.
- When dividing 26 by 4, 6 is the quotient and 2 is the remainder, because 26=6×4+2.
- When dividing 56 by 7, 8 is the quotient and 0 is the remainder, because 56=7×8+0.