0
How does the modulo operator determines wether the number entered is even or not ?
1 Odpowiedź
+ 3
it finds the remainder of division, an even number has a remainder of 0 when divided by 2.
e.g
15/2=7 remainder 1
so 15%2 = 1, thus odd
18/2=9 remainder 0
so 18%2 = 0, thus even