#include <stdio.h> #include <stdint.h> uint8_t reverse_bits(uint8_t val) { // Your logic here uint8_t newVal = 0; for (uint8_t i = 0; i < 8; i++) { newVal |= ((val >> i) & 0x01) << (7 - i); } return newVal; } int main() { uint8_t val; scanf("%hhu", &val); uint8_t result = reverse_bits(val); printf("%u", result); return 0; }
Test Cases
Test Results
Input
26
Expected Output
88