All submissions

Code

#include <stdio.h>

int toggleFifthBit(int n) {
    // Write your code here
    int i;
    int pos=5;
    for(i=0;i<=31;i++)
    {
        if(i==pos)
        {
            n=n^1<<pos;
        }
    }
    return n;
}

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

Solving Approach

 

 

 

Loading...

Input

8

Expected Output

40