Find value of k | CPP program to find k - th bit from right ; Driver Code ; Function Call
#include <bits/stdc++.h> NEW_LINE using namespace std ; void printKthBit ( unsigned int n , unsigned int k ) { cout << ( ( n & ( 1 << ( k - 1 ) ) ) >> ( k - 1 ) ) ; } int main ( ) { unsigned int n = 13 , k = 2 ; printKthBit ( n , k ) ; return 0 ; }