Check if an Octal number is Even or Odd | C ++ code to check if a Octal number is Even or Odd ; Check if the number is odd or even ; Check if the last digit is either '0' , '2' , '4' , or '6' ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; string even_or_odd ( string N ) { int len = N . size ( ) ; if ( N [ len - 1 ] == '0' N [ len - 1 ] == '2' N [ len - 1 ] == '4' N [ len - 1 ] == '6' ) return ( " Even " ) ; else return ( " Odd " ) ; } int main ( ) { string N = "735" ; cout << even_or_odd ( N ) ; return 0 ; }