coperatorsmodulomodulus

What does (10%2) mean?


What does the code (10%2) mean?


Solution

  • % is the modulus operator.

    So this essentially says - what is the remainder of 10 divided by 2?

    10 % 2 == 0
    10 % 5 == 0
    10 % 7 == 3
    10 % 3 == 1