Hexadecimal Number to Decimal

Write a program to convert Hexadecimal Number to Decimal

For example

Input:
10FA

Output:
4346

Solution:

using System;

namespace SearchBinaryTree
{
    class Program
    {
        public static void Main()
        {
            Console.WriteLine("Enter a Hexadecimal Value");
            var hexaDecimalValue = Console.ReadLine();
            var decimalValue = int.Parse(hexaDecimalValue, System.Globalization.NumberStyles.HexNumber);
            Console.WriteLine("Corresponding Decimal value is " + decimalValue);
            Console.ReadLine();
        }
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *