Use This Template

Modulus

Modulus returns the remainder after division of one number by another. The modulus function is useful for determining if a number is even or odd (if n % 2 equals 0, the number is even).

If you want to find out what day of the week it will be after a certain number of days, you can use modulus. If today is Monday (which we can represent as day 1) and we want to know what day it will be 300 days from now, we can use the formula (1 + 300) % 7 (assuming a week is 7 days long, starting with Sunday as 0 and ending with Saturday as 6). The remainder will give us the day of the week.

Modulus

Modulus returns the remainder after the division of one number by another.