#include <stdio.h> #include <stdint.h> uint16_t spread_bits(uint8_t val) { // Your logic here uint16_t reg = 0; for(uint8_t i=0; i<16; i++){ uint8_t bit = (val >> i) & 1u ; reg |= (bit << (2*i)); } return reg; } int main() { uint8_t val; scanf("%hhu", &val); uint16_t result = spread_bits(val); printf("%u", result); return 0; }
leave by 2*i spaces and set them
Test Cases
Test Results
Input
202
Expected Output
20548