#include <stdio.h> int nibble(int num, int pos){ if(pos==0){ return num & 0X0F ; } else{ return (num>>4) & 0X0F ; } } int main (){ int num; int pos; scanf("%d",&num); scanf("%d", &pos); printf("%d",nibble(num,pos)); return 0; }
Test Cases
Test Results
Input
170 0
Expected Output
10