Check whether the binary equivalent of a number ends with "001" or not | C ++ implementation of the above approach ; Function to check if binary equivalent of a number ends in "001" or not ; To check if binary equivalent of a number ends in "001" or not ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool CheckBinaryEquivalent ( int N ) { return ( N - 1 ) % 8 == 0 ; } int main ( ) { int N = 9 ; if ( CheckBinaryEquivalent ( N ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }