0
sameer.chaudhari's Avatar, Join Date: Aug 2007
Newbie Member
// if even then return 1 else return 0

Code:
int even_odd ( int num) 
{
        if (num & 1) 
            return 0;
        return 1;
}

Last edited by shabbir; 10Aug2007 at 13:06.. Reason: Code block
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Code:
bool even (int n)
{
    return !(n & 1);
}
0
listendinesh's Avatar, Join Date: Aug 2007
Go4Expert Member
just changing the way
we acn also get the info from last bit


Code:
int is_numeven(int number)
{
	if(!(number & 1)) 
		return true;

	return false;
}