#include <stdio.h> bool checkBit(unsigned char reg, int pos){ if(reg & (1<<pos)){ return 1; } return 0; } int main() { char reg; int pos; scanf("%hhu %d", ®, &pos); printf("%d", checkBit(reg,pos)); return 0; }
Test Cases
Test Results
Input
8 3
Expected Output
1