Check whether K | CPP program to check if k - th bit of a given number is set or not ; Driver code
#include <iostream> NEW_LINE using namespace std ; void isKthBitSet ( int n , int k ) { if ( n & ( 1 << ( k - 1 ) ) ) cout << " SET " ; else cout << " NOT ▁ SET " ; } int main ( ) { int n = 5 , k = 1 ; isKthBitSet ( n , k ) ; return 0 ; }