Advertisement
remote87

PrintingToConsole

Aug 21st, 2015
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Globalization;
  7.  
  8. namespace _01._1.PrintingToConsoleSecondOpition
  9. {
  10.     class PrintingToConsoleSecondOpition
  11.     {
  12.         static void Main()
  13.         {
  14.             for (int i = 0; i < 3; i++)
  15.             {
  16.                 System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
  17.                 Console.Write("Enter an integer: ");
  18.                 int a = int.Parse(Console.ReadLine());
  19.                 Console.Write("Enter first floating - point number: ");
  20.                 double b = double.Parse(Console.ReadLine());
  21.                 Console.Write("Enter second floating - point number: ");
  22.                 double c = double.Parse(Console.ReadLine());
  23.                 string columnA = Convert.ToString(a, 2);
  24.                 Console.WriteLine("{0,-10}|{1,10}|{2,10}|{3,-10}", "Integer a", "Int to bin", "Double 1", "Double 2");
  25.                 Console.WriteLine("{0,-10:X}|{1}|{2,10:0.00}|{3,-10:0.000}", a, columnA.PadLeft(10, '0'), b, c);
  26.                
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement