Set the Bit in an 8-bit Register

Code

#include <stdio.h>

int main() {
    

    unsigned int reg,pos;

scanf("%u%u",&reg,&pos);

  unsigned int result = reg | (1<<pos);

  printf("%u",result);
    
    return 0;
}

Solving Approach
 

 

 

Upvote
Downvote
Loading...

Input

5 1

Expected Output

7