#include <stdio.h> #include <stdint.h> // Define bitwise macros here #define SET_BITS (uint8_t)132 // 1000 0100 #define CLEAR_BIT (uint8_t)8 // 0000 1000 #define TOGGLE_BIT (uint8_t)32 // 0010 0000 uint8_t modify_register(uint8_t reg) { // Apply operations in order //Set Bits reg |= SET_BITS; //Clear Bits reg &= (~CLEAR_BIT); //Toggle Bits reg ^= TOGGLE_BIT; return reg; } int main() { uint8_t reg; scanf("%hhu", ®); printf("%u", modify_register(reg)); return 0; }
Test Cases
Test Results
Input
0
Expected Output
164