by Vitaly Zayko
24. February 2010 21:15
How to quickly determine is given number odd or even? There are several simple methods.
Here is the first one:
public bool IsEven(int i)
{
return (i & 1) == 0;
}
And the second:
public bool IsEven(int i)
{
return (i % 2) == 0;
}