, #include , #include , #include , #define ARRAY_SIZE 20 , , int hextodec(char hexARRAY_SIZE); , int main() , { , char hex15 = DQ1E240DQ; , printf(DQEnter hexidecimal: DQ); , scanf(DQ%sDQ,hex); , printf(DQ%dDQ,hextodec(hex)); , return 0; , } , , int hextodec(char hexARRAY_SIZE) , { , long long decimal = 0, base = 1; , int i = 0, length; , length = strlen(hex); , for(i = length--; i >= 0; i--) , { , if(hexi >= 0 && hexi <= 9) , { , decimal += (hexi - 48) * base; , base *= 16; , } , else if(hexi >= A && hexi <= F) , { , decimal += (hexi - 55) * base; , base *= 16; , } , else if(hexi >= a && hexi <= f) , { , decimal += (hexi - 87) * base; , base *= 16; , } , } , return decimal; , } , , , ,