Getting error..!

check it:- https://ide.codingblocks.com/s/210535

it shows 2 is an odd number.

Hello @sonu28sharma99,

This is because the compiler is reading the condition as a composite statement of two conditions:
if(n & 1 == 0 )
In the above statement, the precedence of the equality operator is greater than the bitwise AND operator.
Thus it will first check for 1 == 0 i.e. false(or 0) and then do the bitwise AND which will result in false.

SOLUTION:
if((n & 1) == 0 )
This will change the order of evaluation.

Hope, this would help.
Give a like if you are satisfied.