Hexadecimal to Decimal


       

 #include 
#include 

int main()
{
    printf("\nCovert Haxedecimal to decimal\n");

    int num, decimal=0,base=1;
    printf("\nPlease input your Haxedecimal:");
    scanf("%d",&num);

    int temp = num;

    while (temp){
        int rem = temp%10;
        temp = temp / 10;
        decimal +=rem * base;
        base = base * 16;

    }

    printf("\nThe result of Decimal is %d\n",decimal);


    return 0;
}

       
Output