Q:

Write a C# program to convert a hexadecimal number to decimal number

0

Write a C# program to convert a hexadecimal number to decimal number

Sample Output:

Hexadecimal number: 4B0                                                
Convert to-                                                            
Decimal number: 1200

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
using System.Collections.Generic;
public class Exercise30 {
 public static void Main() {
      
     string hexval = "4B0";
     Console.WriteLine("Hexadecimal number: "+hexval);
     int decValue = int.Parse(hexval, System.Globalization.NumberStyles.HexNumber);
     Console.WriteLine("Convert to-");
     Console.WriteLine("Decimal number: "+decValue);
   }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now