Bit toggle solution with xor implementation

/* This code is to toggle bits 
   submitted by Manish Gowda T
   accomplished by simple xor*/


#include <stdio.h>

int toggleFifthBit(int n) {
    int a=32;
    n=a^n;

    return n;
}

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

Solving Approach

 

 

 

Upvote
Downvote
Loading...

Input

8

Expected Output

40