Function that returns false if the number passed as argument contains digit ( s ) other than '0' or '1'
bool isBinary ( int n ) { while ( n != 0 ) { int temp = n % 10 ; if ( temp != 0 && temp != 1 ) { return false ; } n = n / 10 ; } return true ; }