+ 1

what is even?

29th Jul 2016, 3:48 PM
KuramaQ
4 Answers
+ 6
A number is even if we divided it by 2, and the result was a whole number. In C++, we can use the modulus to tell whether or not a number is even. if (x % 2 == 0) { //even } else { //odd }
29th Jul 2016, 4:30 PM
Cohen Creber
Cohen Creber - avatar
+ 1
For example -4, -2, 0, 2, 4 are even.
29th Jul 2016, 3:54 PM
SouthBay
SouthBay - avatar
+ 1
@SouthBay thanks!
29th Jul 2016, 3:57 PM
KuramaQ
+ 1
@Cohen Creber thank you!
29th Jul 2016, 4:33 PM
KuramaQ