[ad_1]
Asked
Viewed
12 times
Write C program to swap the digits of the given input number in the following manner. Bit 0 should be moved to bit 1 location and bit 1 value should be moved to bit 0 location. Similarly bit 2 to bit 3, bit 3 to bit 2, bit 4 to bit 5 and bit 5 to bit 4… and it goes on. Assume the size of the input number is 8 bits only. Provide the provision to get the number from the user (don’t hardcode) and pass the received number to a function as a pointer in the parameter and get the swapped value from the return value of the function and print the same. For ex: input number is 0xA9. -> in binary: 1010 1001. Swapped value should be 0101 0110 -> 0x56
1
lang-c
[ad_2]