#include <stdio.h>
int isKthBitSet(int n, int k) {
// Write your code here
return n = n>>k&1;
}
int main() {
int n, k;
scanf("%d %d", &n, &k);
printf("%d", isKthBitSet(n, k));
return 0;
}
Solving Approach
0000 0000 0000 1000 -> this is the binary of 8.
where k = 3;
n = n>>k&1;
n>>k --> here i am right shifting "3rd" position to "0th" position.