2. Bit Toggle

Back To All Submissions
Previous Submission
Next Submission

Code

#include <stdio.h>
#define bit 5

int toggleFifthBit(int n) {
    // Write your code here
    int temp;
    temp =n ^ (1<<bit);
    return temp;

}

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

Solving Approach

 

 

 

Was this helpful?
Upvote
Downvote