The modulo operation can be achieved using subtraction. As long as the upper number is bigger than the lower number, the lower one is subtracted from the upper one. The result of the subtraction replaces the upper value.
The solution has two main parts: