Set the Bit in an 8-bit Register

Code

#include <stdio.h>
int main(){
    int reg,pos;
    scanf("%d %d",&reg,&pos);
    reg=reg| (1<<pos);
    printf("%d",reg);
    return 0;
}

Solving Approach
 

 

 

Upvote
Downvote
Loading...

Input

5 1

Expected Output

7