Check if a HexaDecimal number is Even or Odd | C # code to check if a HexaDecimal number is Even or Odd ; Check if the number is odd or even ; check if the last digit is either '0' , '2' , '4' , '6' , '8' , ' A ' ( = 10 ) , ' C ' ( = 12 ) or ' E ' ( = 14 ) ; Driver code
using System ; public class GFG { static string even_or_odd ( string N ) { int len = N . Length ; if ( N [ len - 1 ] == '0' N [ len - 1 ] == '2' N [ len - 1 ] == '4' N [ len - 1 ] == '6' N [ len - 1 ] == '8' N [ len - 1 ] == ' A ' N [ len - 1 ] == ' C ' N [ len - 1 ] == ' E ' ) return ( " Even " ) ; else return ( " Odd " ) ; } static public void Main ( ) { string N = " AB3454D " ; Console . WriteLine ( even_or_odd ( N ) ) ; } }