Check a number is odd or even without modulus operator | A simple Java 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
class GFG { static boolean isEven ( int n ) { return ( ( n / 2 ) * 2 == n ) ; } public static void main ( String [ ] args ) { int n = 101 ; if ( isEven ( n ) != false ) System . out . print ( " Even " ) ; else System . out . print ( " Odd " ) ; } }