Modulo Calculator

Enter two numbers and easily calculate their modulo (remainder) value.

Calculate Modulo: \( a \bmod b \)

Result

What is Modulo?

Modulo refers to the remainder left after dividing one number by another. For two numbers \( a \) and \( b \), the modulo operation finds the remainder when \( a \) is divided by \( b \). It is written as: \( a \bmod b \) The result of \( a \bmod b \) is always an integer, ranging from \( 0 \) to \( b - 1 \). If \( a \) is divisible by \( b \), the modulo result is 0; otherwise, it returns the remainder.

How to Calculate Modulo

To compute the modulo of two numbers \( a \) and \( b \) (where \( b \neq 0 \)), use the formula: \( a \bmod b = a - b \times \text{floor}(a / b) \) Here, \(\text{floor}(a / b)\) means rounding \( a / b \) down to the nearest integer.

Examples

Example 1: What is \( 20 \bmod 6 \)?

Solution:

\( 20 \bmod 6 = 20 - 6 \times \text{floor}(20 / 6) = 20 - 6 \times 3 = 20 - 18 = 2\)

Result: \( 20 \bmod 6 = 2 \).

Example 2: What is \( 15 \bmod 4 \)?

Solution:

\( 15 \bmod 4 = 15 - 4 \times \text{floor}(15 / 4) = 15 - 4 \times 3 = 15 - 12 = 3\)

Result: \( 15 \bmod 4 = 3 \).

Example 3: What is \( 50 \bmod 10 \)?

Solution:

\( 50 \bmod 10 = 50 - 10 \times \text{floor}(50 / 10) = 50 - 10 \times 5 = 50 - 50 = 0\)

Result: \( 50 \bmod 10 = 0 \).