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

  • برمجة سي شارب
  • برمجة

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

Sample Output:

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

الأجوبة

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);
   }
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...