#include<stdio.h>
#include<math.h>
main()
{
int i=0,j,c,s[100];
double t=0;
while((c=getchar())!='\n')
{
s[i]=c;
++i;
}
for(j=i;j>0;--j)
{
t=t+(s[i-1]*(pow(16,(4-((double)i)))));
--i;
}
printf("%d",(int)t);
return 0;
}
HI, i need to write a program that converts an hexadecimal number into integer form (for convenience i'm only considering hexadecimal no. without alphabets from a to f).
The program which i've written above is for the same conversion but the output is not right. I tried to find the error but failed. It would be a great help if you give suggestions to correct the above code. Pls do not ask me to write the program using some other method.:?: