#include <stdio.h> #include <stdint.h> uint32_t extract_even_bits(uint32_t reg) { // Your code here int bit=31; int val=0; int pos=15; while(bit>=0) { if(bit%2==0) { int a=0; a=reg>>bit&1; if(a==0) { val&=~(1<<pos); } else val|=1<<pos; pos--; } bit--; } return val; } int main() { uint32_t reg; scanf("%u", ®); printf("%u", extract_even_bits(reg)); return 0; }
Test Cases
Test Results
Input
85
Expected Output
15