#include <stdio.h>
int toggleFifthBit(int n) {
// Write your code here
n = n ^ 32;
return n;
}
int main() {
int n;
scanf("%d", &n);
printf("%d", toggleFifthBit(n));
return 0;
}
Solving Approach
So the basic requirement is to toggle the value of the 5th bit, hence to obtain such result the bitwise logical operator must be XOR and the mask should contain 1 at the 5th bit (from the left) and rest of them can be 0s.