Advertisement
Svetli0o

OnesAndZeros

Apr 3rd, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.47 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.  
  7. class Program
  8. {
  9.     static void Main(string[] args)
  10.     {
  11.         int n = int.Parse(Console.ReadLine());
  12.         for (int i = 0; i < 5; i++)
  13.         {
  14.             for (int j = 15; j >= 0; j--)
  15.             {
  16.                 int digit = (n >> j) & 1;
  17.                 if (digit == 1)
  18.                 {
  19.                     if (i == 0)
  20.                     {
  21.                         Console.Write(".#.");
  22.                     }
  23.                     else if (i == 1)
  24.                     {
  25.                         Console.Write("##.");
  26.                     }
  27.                     else if (i == 2 || i == 3)
  28.                     {
  29.                         Console.Write(".#.");
  30.                     }
  31.                     else if (i == 4)
  32.                     {
  33.                         Console.Write("###");
  34.                     }
  35.                 }
  36.                 else
  37.                 {
  38.                     if (i == 0 || i == 4)
  39.                     {
  40.                         Console.Write("###");
  41.                     }
  42.                     else if (i == 1 || i == 2 || i == 3)
  43.                     {
  44.                         Console.Write("#.#");
  45.                     }
  46.                 }
  47.                 if (j != 0)
  48.                 {
  49.                     Console.Write(".");
  50.                 }
  51.             }
  52.             Console.WriteLine();
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement