90. Bit Reversal in an 8-bit Value

You are given an 8-bit unsigned integer. Your task is to:

  • Reverse the order of its bits
  • Print the resulting 8-bit value (in decimal)

You must not use any lookup table or standard library function. Use pure bitwise logic.


Example-1

Input: val = 0b00011010
Output: 0b01011000 → Decimal: 88


Example-2

Input: val = 0b10110000
Output: 0b00001101 → Decimal: 13


Example-3

Input: val = 255
Output: 255 (All bits reversed remain the same)


 

Loading...

Input

26

Expected Output

88