Code

#include <stdio.h>

int toggleFifthBit(int n) {
    // Write your code here
    int num = 0x20;
    return (num ^ n);
}

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

Solving Approach

 

used xor for toggling the bit create an offset for the desired number and xor with it result will be toggled number of offset and given number

 

Upvote
Downvote
Loading...

Input

8

Expected Output

40