Advertisement
KlimentHristov

Figure.Dumbel

Nov 23rd, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2. class Dumbel
  3. {
  4.     static void Main()
  5.     {
  6.         int n = int.Parse(Console.ReadLine());
  7.  
  8.         // First Line
  9.         int firstDots = n/2;
  10.         int amPer = n/2+1;
  11.         Console.WriteLine("{0}{1}{2}{1}{0}",
  12.             new string('.', firstDots),new string('&', amPer),new string('.', n),
  13.             new string('.', firstDots),new string('&', amPer));
  14.         // EndFirst Line
  15.  
  16.         // Second line
  17.         int middleLines = n / 2 - 1;
  18.         for (int i = 0; i < middleLines; i++)
  19.         {
  20.             Console.WriteLine("{0}&{1}&{2}&{1}&{0}",
  21.                 new string('.',n/2-1-i),new string ('*',n/2+i),new string ('.',n));
  22.         }
  23.         // EndSecond line
  24.  
  25.         // Third line
  26.         Console.WriteLine("&{0}&{1}&{0}&", new string ('*',n-2),new string ('=',n));
  27.         // EndThird line
  28.  
  29.         // Fourth Line
  30.         for (int i = 0; i < middleLines; i++)
  31.         {
  32.             Console.WriteLine("{0}&{1}&{2}&{1}&{0}",
  33.                 new string('.',1+i), new string('*', n -3-i), new string('.', n));
  34.         }
  35.         // EndFOurthLine
  36.  
  37.         // Last Line
  38.         Console.WriteLine("{0}{1}{2}{1}{0}",
  39.             new string('.', firstDots), new string('&', amPer), new string('.', n),
  40.             new string('.', firstDots), new string('&', amPer));
  41.         // EndLast Line
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement