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 ; Driver Code
class GFG { static boolean isEven ( int n ) { boolean isEven = true ; for ( int i = 1 ; i <= n ; i ++ ) isEven = ! isEven ; return isEven ; } public static void main ( String args [ ] ) { int n = 101 ; if ( isEven ( n ) ) System . out . println ( " Even " ) ; else System . out . println ( " Odd " ) ; } }