Check if a number has two adjacent set bits | CPP program to check if there are two adjacent set bits . ; Driver Code
#include <iostream> NEW_LINE using namespace std ; bool adjacentSet ( int n ) { return ( n & ( n >> 1 ) ) ; } int main ( ) { int n = 3 ; adjacentSet ( n ) ? cout << " Yes " : cout << " No " ; return 0 ; }