#include <stdio.h>
int isKthBitSet(int n, int k) {
// Write your code here
return (n >> k & 1) ? 1 : 0; // checking the k th bit set or clear
}
int main() {
int n, k;
scanf("%d %d", &n, &k);
printf("%d", isKthBitSet(n, k));
return 0;
}
Solving Approach
int isKthBitSet(int n, int k) {
// Write your code here
return (n >> k & 1) ? 1 : 0; // checking the k th bit set or clear
}