This equation can be used to calculate the modulo operation:
A percentage of b equals b - floor(a / b)*a
The amount of times you can divide a by b is shown by floor(a / b).
The amount that was successfully shared in full was floor(a / b)*b.
The remainder of the division is equal to the sum (a) less what was shared.
Using the previous illustration, this results in:
5 percent 7 is 5 minus floor(5 / 7) * 7 = 5.