27.03.2009, 16:14
from pawn-lang
You would have to divide the number by 2 and if there is no remainder...its even. If there is a remainder...its odd.
I >>sUCK<< at math tho..so doulbe check that.
^try that, maybe?
Quote:
|
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. |
I >>sUCK<< at math tho..so doulbe check that.
Code:
IsNumberEven(number) {
new remainder = number % 2;
if(remainder > 0) return false;
else return true;
}

