Can the result of a modulo operation be larger than the divisor?

#1

Question

In the context of this exercise, can the result of a modulo operation be larger than the divisor?

No, the result of a modulo operation can never be larger than the divisor, assuming all positive values being used in the operation. If the division is done correctly, then the divisor was fitted into the dividend as many times as possible. If the remainder is larger than the divisor, then this means the divisor could still be fitted into the dividend, so that means the division was not done correctly.

Explanation

"""
Take for example
10 % 3

Dividend: 10
Divisor: 3

We divide the divisor into the dividend as many times as possible,
until we cannot fit it into the divident any more.
10 >= 3 * 1
10 >= 3 * 2
10 >= 3 * 3
10 < 3 * 4 # Stop at the previous.

We stop at 3 * 3 because the 3 * 4 does not fit into 10 anymore.

We then take the remainder of this,
10 – 3 * 3 = 1

Therefore the remainder is 1, which is less than the divisor, 3.
"""

The only way that the remainder would be greater than the divisor would be if we stopped at 3 * 2 or earlier, which would have been incorrect.