Advertisement
bacco

Integer to Hex and Binary

May 22nd, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None | 0 0
  1. using System;
  2.  
  3. namespace IntegertoHexandBinary
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             var number = int.Parse(Console.ReadLine());
  10.  
  11.             string hex = Convert.ToString(number, 16).ToUpper();
  12.             string binary = Convert.ToString(number, 2);
  13.  
  14.             Console.WriteLine(hex);
  15.             Console.WriteLine(binary);
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement