Code

#include <stdio.h>

int toggleFifthBit(int n) {
    // Write your code here
    n ^= (0x01 << 5);
    return n;
}

int main() {
    int n;
    scanf("%d", &n);
    printf("%d", toggleFifthBit(n));
    return 0;
}

Solving Approach

 

Just using the Bit-wise Ex-OR on the 5th Bit of n to manipulate the current number 

 

Upvote
Downvote
Loading...

Input

8

Expected Output

40