i need a program to convert hexa decimal number to decimal number, a very simple program without using %x i have been trying to come up with a logic but couldnt do so, i wrote a program using string to take input

scanf("%s", &hexDecimal);

and then using if else conditons to do the maths like this

if (hexaDecimal[i]=='0')

{

n=n-1;

x=pow(16, n);

decimalNumber[i]=0*x;

}

if (hexaDecimal[i]=='1')

{,

n=n-1;

x=pow(16, n);

decimalNumber[i]=1*x;

}

and continue using such if else condition from 0-9 and then A-F which represents number bigger than 9. but i get an overflow error, so i am stuck. please anyone who can write a simple program i will be very thankful. and yeah write it in c language, thanks a lot.