Calculate modulo operations (a mod b) with step-by-step explanations. Perfect for programmers, math students, and anyone working with remainder calculations.
Where a is the dividend and b is the divisor
The number being divided (can be negative)
The number to divide by (cannot be zero)
The modulo operation finds the remainder after division of one number by another. It's denoted as a mod b or a % b in programming.
Remember: The mathematical definition ensures the result is always non-negative when the divisor is positive.
Array index wrapping: i % array.length
Even/odd check: n % 2 == 0
Circular buffer: (index + 1) % bufferSize
Hash table indexing: hash % tableSize
Modular arithmetic: (a + b) mod m
Cryptography: RSA encryption
Number theory: GCD calculations
Congruence relations: a ≡ b (mod m)
Clock arithmetic: (hour + n) % 12
Day of week: day % 7
Circular patterns: step % cycle
Remainder calculations