#include <stdio.h>
int toggleFifthBit(int n) {
// Write your code here
return n ^= 0x20;
}
int main() {
int n;
scanf("%d", &n);
printf("%d", toggleFifthBit(n));
return 0;
}
Solving Approach
You can just return 'n' XOR'd with a bit mask of 0x20 (0b00100000) or a value with a 1 in the 6th absolute bit position.