Code

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

Solving Approach

Use XOR with bitmask (1 << 5) to toggle the 5th bit while preserving all other bits

 

 

Upvote
Downvote
Loading...

Input

8

Expected Output

40