27.03.2009, 15:01
Hello!
How can I tell if a number is odd, or even?
How can I tell if a number is odd, or even?
|
e1 % e2 Results in the remainder of the division of e1 by e2. The sign of the remainder follows the sign of e2. Integer division and remainder have the Euclidean property: D = q*d + r, where q = D/d and r = D%d. |
IsNumberEven(number) {
new remainder = number % 2;
if(remainder > 0) return false;
else return true;
}
#define IsOdd(%0) %0 % 2