#include <stdio.h>
int isKthBitSet(int n, int k) {
// Write your code here
if( (n>>k)& 1)
return 1;
return 0;
}
int main() {
int n, k;
scanf("%d %d", &n, &k);
printf("%d", isKthBitSet(n, k));
return 0;
}
Solving Approach
move that one bit to lsb and & with 1 return 1 if that is 1 else 0