Advertisement
Fundamentalen

DecimalToHexadecimal

Mar 26th, 2014
860
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.37 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3.  
  4. class DecimalToHexadecimal
  5. {
  6.     static void Main()
  7.     {
  8.         Console.Write("Enter your decimal number: ");
  9.         long dec = long.Parse(Console.ReadLine());
  10.  
  11.         string hexaStr = dec.ToString("X");
  12.  
  13.         long hexa = long.Parse(hexaStr, NumberStyles.HexNumber);
  14.  
  15.         Console.WriteLine(hexaStr);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement