Advertisement
aslv

Formatting Numbers

Mar 31st, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FormattingNumbers
  4. {
  5.     class FormatNums
  6.     {
  7.         static void Main()
  8.         {
  9.             Console.Write("a = ");
  10.             short a = short.Parse(Console.ReadLine());
  11.             Console.Write("b = ");
  12.             float b = float.Parse(Console.ReadLine());
  13.             Console.Write("c = ");
  14.             float c = float.Parse(Console.ReadLine());
  15.  
  16.             Console.WriteLine("|{0,-10:X}|{1}|{2,10:0.00}|{3,-10:F3}|", a, Convert.ToString(a, 2).PadLeft(10, '0'), b, c);
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement