VelizarAvramov

14. Integer to Hex and Binary

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