#include <stdio.h> #include <stdint.h> int is_bit_set(unsigned char reg, int pos) { // Your code here if ((reg & (1<<pos))==0) return 0; else return 1; } int main() { int reg, pos; scanf("%hhu %hhu", ®, &pos); printf("%u", is_bit_set(reg, pos)); return 0; }
Test Cases
Test Results
Input
4 2
Expected Output
1