Modulo Using Recursion
In this lesson, we will learn about the modulo operation and how to implement it using recursion.
What is the modulo operation?
The modulo operation (abbreviated as mod) finds the remainder after the division of one number - the dividend, by another number - the divisor.
Below is an image to revise the concept of the remainder using a basic division example:
In the example above, we have divided 14, the dividend, by 4, the divisor. 3 is the quotient and 2 is the remainder.
If we were to use a mod function, it would be implemented as follows:
We read this as 14 mod 4 is equal to 2.
Note: If the dividend is fully divisible by the divisor, the remainder is .
Below is a short quiz to test ...
Access this course and 1400+ top-rated courses and projects.