#include <stdio.h> int main() { unsigned int reg, pos, mode; // Input: Register value, bit position, operation mode scanf("%u %u %u", ®, &pos, &mode); if (mode == 1) reg |= (1 << pos); // Set the bit else reg &= ~(1 << pos); // Clear the bit printf("%u\n", reg); // Output the modified register value return 0; }
Test Cases
Test Results
Input
10 3 1
Expected Output
10