Find odd int

Hello,

Please anyone can help me to find nearest odd int

there's way of finding it using if statement

like this
1
2
3
4
if( lo%2 == 0 ) // integer part of x is even
        cout <<"nearest even is " <<lo <<", nearest odd is " <<hi <<endl;
    else // integer part of x is odd
        cout <<"nearest even is " <<hi <<", nearest odd is " <<lo <<endl;


But my question is there any other way to do it !
Topic archived. No new replies allowed.