#include <stdio.h>
// Function to set a specific bit
unsigned char setBit(unsigned char reg, int pos) {
reg |= (1 << pos);
return reg;
}
int main() {
unsigned char reg;
int pos;
// Input format: binary number (as decimal) and bit position
scanf("%hhu %d", ®, &pos);
// Output the updated register value
printf("%d", setBit(reg, pos));
return 0;
}
Input
5 1
Expected Output
7