fbinnzhivko

03.01 Dress Pattern

Apr 21st, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.40 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         var n = int.Parse(Console.ReadLine());
  7.  
  8.         //TOP
  9.         Console.Write(new string('_', n * 4));
  10.         Console.Write(".");
  11.         Console.Write(new string('_', n * 4));
  12.         Console.Write(".");
  13.         Console.Write(new string('_', n * 4));
  14.         Console.WriteLine();
  15.  
  16.         for (int row = 1; row <= n * 2; row++)
  17.         {
  18.             Console.Write(new string('_', n * 4 - row * 2));
  19.             Console.Write(".");
  20.             if (row == 1) Console.Write(new string('*', row * 2));
  21.             else Console.Write(new string('*', row * 2 + row - 1));
  22.             Console.Write(".");
  23.             Console.Write(new string('_', n * 4 - row * 2));
  24.             Console.Write(".");
  25.             if (row == 1) Console.Write(new string('*', row * 2));
  26.             else Console.Write(new string('*', row * 2 + row - 1));
  27.             Console.Write(".");
  28.             Console.Write(new string('_', n * 4 - row * 2));
  29.             Console.WriteLine();
  30.         }
  31.  
  32.         //UNDER THE (.)(.) + BELT :)
  33.  
  34.         for (int i = 0; i <= n; i++)
  35.         {
  36.             if (i < n)
  37.             {
  38.                 Console.Write(".");
  39.                 Console.Write(new string('*', 12 * n));
  40.                 Console.Write(".");
  41.                 Console.WriteLine();
  42.             }
  43.             else
  44.             {
  45.                 Console.Write(new string('.', n * 3));
  46.                 Console.Write(new string('*', (12 * n + 2) - n * 6));
  47.                 Console.Write(new string('.', n * 3));
  48.                 Console.WriteLine();
  49.             }
  50.         }
  51.  
  52.         for (int i = 0; i < n; i++)
  53.         {
  54.             Console.Write(new string('_', n * 3));
  55.             Console.Write(new string('o', (12 * n + 2) - n * 6));
  56.             Console.Write(new string('_', n * 3));
  57.             Console.WriteLine();
  58.         }
  59.  
  60.         //BOTTOM
  61.  
  62.         for (int row = 1; row <= n * 3; row++)
  63.         {
  64.             Console.Write(new string('_', n * 3 + 1 - row));
  65.             Console.Write(".");
  66.             if (row % 2 == 1) Console.Write(new string('*', n * 6 + (row - 1) * 2));
  67.             else Console.Write(new string('*', n * 6 + (row - 1) * 2));
  68.             Console.Write(".");
  69.             Console.Write(new string('_', n * 3 + 1 - row));
  70.             Console.WriteLine();
  71.         }
  72.         Console.WriteLine(new string('.', 12 * n + 2));
  73.     }
  74. }
Add Comment
Please, Sign In to add comment