grach

2016_August_28 Axe

Oct 14th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.83 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. namespace axe
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.             {
  13.                 var n = int.Parse(Console.ReadLine());
  14.                 var width = 5 * n;
  15.                 var leftDashes = 3 * n;
  16.                 var middleDashes = 0;
  17.                 var rightDashes = width - leftDashes - middleDashes - 2;
  18.  
  19.                 for (int i = 0; i < n; i++)
  20.                 {
  21.                     Console.WriteLine("{0}*{1}*{2}",
  22.                         new string('-', leftDashes),
  23.                         new string('-', middleDashes),
  24.                         new string('-', rightDashes));
  25.                     middleDashes++;
  26.                     rightDashes--;
  27.                 }
  28.  
  29.                 middleDashes--;
  30.                 rightDashes++;
  31.                 for (int i = 0; i < n / 2; i++)
  32.                 {
  33.                     Console.WriteLine("{0}*{1}*{2}",
  34.                         new string('*', leftDashes),
  35.                         new string('-', middleDashes),
  36.                         new string('-', rightDashes));
  37.                 }
  38.  
  39.                 for (int i = 0; i < n / 2 - 1; i++)
  40.                 {
  41.                     Console.WriteLine("{0}*{1}*{2}",
  42.                         new string('-', leftDashes),
  43.                         new string('-', middleDashes),
  44.                         new string('-', rightDashes));
  45.                     leftDashes--;
  46.                     middleDashes += 2;
  47.                     rightDashes--;
  48.                 }
  49.                 Console.WriteLine("{0}*{1}*{2}",
  50.                         new string('-', leftDashes),
  51.                         new string('*', middleDashes),
  52.                         new string('-', rightDashes));
  53.             }
  54.         }
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment