#include <stdio.h> #include <stdint.h> uint16_t spread_bits(uint8_t val) { // Your logic here uint16_t uhRes = 0; for(int i = 7; i >= 0; --i)\ { uhRes <<= 2; uint8_t ucBit = ((val >> i) & 0x01U); uhRes |= ucBit; } return uhRes; } int main() { uint8_t val; scanf("%hhu", &val); uint16_t result = spread_bits(val); printf("%u", result); return 0; }
Test Cases
Test Results
Input
202
Expected Output
20548