#include <stdio.h> int main() { int n; scanf("%d", &n); printf("%d", n ^ (1 << 5)); return 0; }
Use XOR with bitmask (1 << 5) to toggle the 5th bit while preserving all other bits
(1 << 5)
Test Cases
Test Results
Input
8
Expected Output
40