Write a C program to extract a nibble (4-bit value) from an 8-bit register.
Input Format
Output Format
Example-1
Input: reg = 0xAB, pos = 0
Output: 11
(0xAB → lower nibble = 0xB = 11)
Example-2
Input: reg = 0xAB, pos = 1
Output: 10
(0xAB → upper nibble = 0xA = 10)
Example-3
Input: reg = 0xFF, pos = 0
Output: 15
Input
170 0
Expected Output
10