+ 1
what is even?
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
}
+ 1
For example -4, -2, 0, 2, 4 are even.
+ 1
@SouthBay thanks!
+ 1
@Cohen Creber thank you!