#include <stdio.h>
int isKthBitSet(int n, int k) {
return (n>>k) & 1;
}
int main() {
int n, k;
scanf("%d %d", &n, &k);
printf("%d", isKthBitSet(n, k));
return 0;
}
Solving Approach
AS we only need whether that bit is set(1) or not set(0) same notations are used for ouput. you just return the same