#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; }
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
Test Cases
Test Results
Input
8
Expected Output
40