Advertisement
ivan_yosifov

Ones_And_Zeroes_v2

Dec 8th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2.  
  3. class OnesAndZeros
  4. {
  5.     static void Main()
  6.     {
  7.         int N = int.Parse(Console.ReadLine());
  8.         string[,] digitDrawer = new string[5, 2] {{"###", ".#."},
  9.                                                   {"#.#", "##."},
  10.                                                   {"#.#", ".#."},
  11.                                                   {"#.#", ".#."},
  12.                                                   {"###", "###"} };
  13.  
  14.         for (int row = 0; row < 5; row++)
  15.         {
  16.             for (int j = 15; j >= 0; j--)
  17.             {
  18.                 int bit = (N >> j) & 1;
  19.                 Console.Write("{0}", digitDrawer[row, bit]);
  20.                 if (j != 0) Console.Write('.');
  21.             }
  22.             Console.WriteLine();
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement