6. Set the Bit in an 8-bit Register

You are working with an 8-bit control register. Write a function to set the bit at a given position without affecting other bits.

Use 0-based indexing for bit positions (0 = LSB, 7 = MSB).


Example 1

Input: reg = 0b00000101, pos = 1
Output: 0b00000111


Example 2

Input: reg = 0b00001000, pos = 0
Output: 0b00001001
Loading...

Input

5 1

Expected Output

7