All submissions

Toggle the Bit in an 8-bit Register

Code

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

Solving Approach

 

 

 

Loading...

Input

6 1

Expected Output

4