#include <stdio.h> int isKthBitSet(int n, int k) { int a = 0; a = ( ( 1<<k ) & n ); return ( a!=0 )?1:0; } int main() { int n, k; scanf("%d %d", &n, &k); printf("%d", isKthBitSet(n, k)); return 0; }
Test Cases
Test Results
Input
8 3
Expected Output
1