[Solved] Modulo operation, why does 4 % 12 give the number 4?


The modulo operator, more or less, just gives you the remainder of the division. So:

12 % 4 = 0 since 12 / 4 = 3 remainder 0

Whereas, since 12 doesn’t divide 4:

4 % 12 = 4 since 4 / 12 = 0 remainder 4

For more information, see the Wikipedia article, or perhaps the Wolfram article.

solved Modulo operation, why does 4 % 12 give the number 4?