Swap any two bits

C program to swap any two bits in the given number.

#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    n=n^1<<1;
    n=n^1<<2;
    printf("%d",n);
    return 0;
}
Sample Input::
2
Sample Output::
4

For mini projects click here
CSE Materials click here