#include <stdio.h> #include <stdint.h> unsigned char toggleBit(unsigned char reg, int pos){ reg^=(1 << pos); return reg; } int main(){ unsigned char reg; int pos; scanf("%hhu %d" , ®, &pos); printf("%d\n", toggleBit(reg, pos)); return 0; }
Test Cases
Test Results
Input
6 1
Expected Output
4