CPP program to check if k - th bit of a given number is set or not using right shift operator .
#include <iostream> NEW_LINE using namespace std ; void isKthBitSet ( int n , int k ) { if ( ( n >> ( k - 1 ) ) & 1 ) cout << " SET " ; else cout << " NOT ▁ SET " ; }