Check a number is odd or even without modulus operator | A simple C ++ program to check for even or odd ; Returns true if n is even , else odd ; Return true if n / 2 does not result in a float value . ; Driver code
#include <iostream> NEW_LINE using namespace std ; bool isEven ( int n ) { return ( ( n / 2 ) * 2 == n ) ; } int main ( ) { int n = 101 ; isEven ( n ) ? cout << " Even " : cout << " Odd " ; return 0 ; }