All submissions

Code

#include <stdio.h>

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

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

Solving Approach

TOGGLE 5th bit of a number by XOR operation by mask value 0010 0000

for toggling any bit mask value is set the perticular bit as 1 then perform XOR

 

Loading...

Input

8

Expected Output

40