#include <stdio.h>
int isKthBitSet(int n, int k) {
// Write your code here
return ((n>>k)&1);
}
int main() {
int n, k;
scanf("%d %d", &n, &k);
printf("%d", isKthBitSet(n, k));
return 0;
}
Solving Approach
The above problem is similar to the checking bit status of the given number. if the particular bit is 1, then the bit is set, otherwise not set(clear).