#include <stdio.h>
int isKthBitSet(int n, int k) {
// Write your code here
if( n&(1<<k))
return 1;
return 0;
}
int main() {
int n, k;
scanf("%d %d", &n, &k);
printf("%d", isKthBitSet(n, k));
return 0;
}
Solving Approach
When AND operation is performed we are doing with only one bit rest of the bits become 0 if it is set one we get none Zero return Value if the bit is Zero then with and operation we get a Zero value as return