All submissions

Code

#include <stdio.h>

int toggleFifthBit(int n) {
    // Write your code here
    int mask = 0x20;
    // any value (0, 1) xor with 0 keeps the value unchanged.
    // any value (0, 1) xor with 1 flips the value.
    return (n ^ mask);
}


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

Solving Approach

 

 

 

Loading...

Input

8

Expected Output

40