find the number formed by just inverting the bits of the number
Answers
Answered by
1
Reverse actual bits of the given number
Given a non-negative integer n. The problem is to reverse the bits of n and print the number obtained after reversing the bits. Note that the actual binary representation of the number is being considered for reversing the bits, no leading 0’s are being considered.
Examples :
Input : 11 Output : 13 (11)10 = (1011)2. After reversing the bits we get: (1101)2 = (13)10. Input : 10 Output : 5 (10)10 = (1010)2. After reversing the bits we get: (0101)2 = (101)2 = (5)10.
hope it help you
Given a non-negative integer n. The problem is to reverse the bits of n and print the number obtained after reversing the bits. Note that the actual binary representation of the number is being considered for reversing the bits, no leading 0’s are being considered.
Examples :
Input : 11 Output : 13 (11)10 = (1011)2. After reversing the bits we get: (1101)2 = (13)10. Input : 10 Output : 5 (10)10 = (1010)2. After reversing the bits we get: (0101)2 = (101)2 = (5)10.
hope it help you
Similar questions