Check whether a given number is even or odd | C # program program to check for even or odd ; Returns true if n is even , else odd ; n & 1 is 1 , then odd , else even ; Driver code
using System ; class GFG { public static bool isEven ( int n ) { if ( ( n & 1 ) == 0 ) return true ; else return false ; } public static void Main ( ) { int n = 101 ; if ( isEven ( n ) == true ) Console . WriteLine ( " Even " ) ; else Console . WriteLine ( " Odd " ) ; } }