iliya87

03.DrawHeadPhones

Mar 24th, 2015
241
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 Program
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.         Console.WriteLine("{0}{1}{0}",new string('-',(n-1)/2),new string ('*',n+2));
  9.         for (int i = 0; i <n-1; i++)
  10.         {
  11.             Console.WriteLine("{0}*{1}*{0}", new string('-', (n-1)/2), new string('-', n ));
  12.         }
  13.         for (int i = 0,count=0; i < n; i++)
  14.         {
  15.             Console.WriteLine("{0}{1}{2}{1}{0}",
  16.                 new string('-',((n-1)/2)-count),
  17.                 new string('*',1+2*count),
  18.                 new string('-',n-2*count));
  19.             if (i < n/2)
  20.             {
  21.                 count++;
  22.             }
  23.             else
  24.             {
  25.                 count--;
  26.             }
  27.  
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment