#include <stdio.h> #include <stdint.h> uint8_t extract_field(uint16_t reg){ return (reg >> 4) & 0x1F; } int main(){ uint16_t reg; scanf("%hx", ®); printf("%hhu", extract_field(reg)); return 0; }
Test Cases
Test Results
Input
0x01F0
Expected Output
31