+ 2
It is possible to chack The given number is even or odd without using rimender Opreter in ç++
3 Answers
+ 6
You can use the binary & to check the least significant bit.
if(num & 1){ /* odd */ }
else { /* even */ }
+ 4
or...
if(typeof num/2=="integer") //even
if(typeof num/2=="float") //odd
+ 1
while(num>0)
{num-=2;
if(num==0)
{ alert("even");
break;
}
else{
alert("odd");
break;
}
}