#include <stdio.h> #include <stdint.h> void decode_status(uint8_t num) { // Your logic here if(num>>0&1) printf("Power On\n"); if(num>>1&1) printf("Error\n"); if(num>>2&1) printf("Tx Ready\n"); if(num>>3&1) printf("Rx Ready\n"); if(num>>4&1) printf("Overheat\n"); if(num>>5&1) printf("Undervoltage\n"); if(num>>6&1) printf("Timeout\n"); if(num>>7&1) printf("Reserved\n"); } int main() { uint8_t reg; scanf("%hhu", ®); decode_status(reg); return 0; }
Solving Approach
Test Cases
Test Results
Input
13
Expected Output
Power On Tx Ready Rx Ready