How does the modulo operator determines wether the number entered is even or not ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does the modulo operator determines wether the number entered is even or not ?

9th Aug 2016, 4:45 PM
Bassil Orabii
Bassil Orabii - avatar
1 Answer
+ 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
10th Aug 2016, 9:16 PM
Nick