A program that read any hexadecimal number & display equivalent decimal number in C.

#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
    char st[100];
    long i,n,l;
    clrscr();
    printf("Enter any hexadecimal number : ");
    scanf("%s",st);
    n=0;
    l=strlen(st);
    for(i=0;i<l;i++)
    if(st[i]>='0' && st[i]<='9')
    n=n*16+st[i]-48;
    else if(st[i]>='A' && st[i]<='F')
    n=n*16+st[i]-55;
    else if(st[i]>='a' && st[i]<='f')
    n=n*16+st[i]-87;
   
    printf("Equivalent decimal number is : %ld",n);
    getch();
}


///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........