#include <stdio.h>
int isKthBitSet(int n, int k) {
// Write your code here
return ((n >> k) & 0x01);
}
int main() {
int n, k;
scanf("%d %d", &n, &k);
printf("%d", isKthBitSet(n, k));
return 0;
}
Solving Approach
shift by k times to move to lsb position, at the end the and with 0x01 to get required output.