Programming Practice

Let x be an unsigned integers (32-bit long) variable. Write a program to swap two neighboring bits starting from the the most significant bits. That is, if x is x31x30x29x28¼x3x2x1x0, then after swapping the neighboring bits the result becomes x30x31x28x29¼x2x3x0x1.

Enter an unsigned integer value of x (8 hexadecimal digits): AAAA5555
The input data:      x=0XAAAA5555
The swapping result: y=0X5555AAAA