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