All submissions

Code

#include <stdio.h>

int toggleFifthBit(int n) {
    // Write your code here
    /*As the 5th bit has to be toggled, so set 5th bit
    and than XOR with the number
    */
    n = n ^ (1<<5);
    return n;
}

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

Solving Approach

As the 5th bit has to be toggled, so set 5th bit and then XOR with the number.

 

 

Loading...

Input

8

Expected Output

40