#include <iostream>
using namespace std;
unsigned int swapBits(unsigned int n)
    {
    	unsigned int odds = n & 0x55555555;
    	unsigned int evens = n & 0xAAAAAAAA;
    	odds <<= 1;
    	evens >>= 1;
    	return (odds | evens);
    }
int main() {
    unsigned int n;
    cin>>n;
    unsigned int ans=swapBits(n);
    cout<<ans;
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: