Modulo Operator: Practical Uses in Arithmetics

Use modular arithmetic to calculate a position on a clock or another repeating cycle.

Result
—

How to calculate

Add the offset to the start and divide by the cycle length. A nonnegative remainder gives the new label. The same calculation applies to cyclic counters and repeating schedules.

Worked example

Use Start value 10 · Cycle length 12 · Units forwards or backwards 5. The result is 3.

Input and result notes

Enter a cycle length of at least 2. Labels start at 0. On a 12 hour clock, label 0 represents 12.

Kwong on modular arithmetic

Related calculators