Advertisement
KlimentHristov

Figure.Plane

Nov 23rd, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.17 KB | None | 0 0
  1. using System;
  2. class Plane
  3. {
  4.     static void Main(string[] args)
  5.     {
  6.         int n = int.Parse(Console.ReadLine());
  7.  
  8.         int widht = n * 3;
  9.         int height = (n * 3) - (n / 2);
  10.  
  11.         char dot = '.';
  12.         char stars = '*';
  13.  
  14.         int leftDost = (widht - 1) / 2;
  15.  
  16.         // first row
  17.         Console.WriteLine("{0}{1}{0}",new string(dot,leftDost),new string (stars,1));
  18.         // end first row
  19.  
  20.         // second row
  21.         int secondOutDots = leftDost-1;
  22.         int secondInnerDots = 1;
  23.         int yellowRow = (n / 2) + 2;
  24.         for (int i = 0; i <yellowRow; i++)
  25.         {
  26.             Console.WriteLine("{0}*{1}*{0}",
  27.                 new string(dot,secondOutDots), new string(dot, secondInnerDots));
  28.             secondOutDots--;
  29.             secondInnerDots += 2;
  30.         }
  31.         // end second
  32.        
  33.         // third row
  34.         int redRow = n / 2 - 1;
  35.         int thirdDots = n-4;
  36.         int thirdInnerDots = secondInnerDots+2;
  37.        
  38.         for (int i = 0; i < redRow; i++)
  39.         {
  40.              Console.WriteLine("{0}*{1}*{0}",
  41.                  new string (dot,thirdDots),new string (dot,thirdInnerDots));
  42.              thirdDots -= 2;
  43.              thirdInnerDots += 4;
  44.         }
  45.         // end
  46.  
  47.         // four row
  48.         Console.WriteLine("*{0}*{1}*{0}*",new string (dot,n-2),new string (dot,n));
  49.         // end four
  50.  
  51.         // five row
  52.         int fiveDots = n - 4;
  53.         int fiveSecDots =1;
  54.         for (int i = 0; i < redRow; i++)
  55.         {
  56.             Console.WriteLine("*{0}*{1}*{2}*{1}*{0}*",
  57.                 new string (dot,fiveDots),
  58.                 new string (dot,fiveSecDots),
  59.                 new string (dot,n));
  60.             fiveDots -= 2;
  61.             fiveSecDots+=2;
  62.         }
  63.         // end
  64.  
  65.         // six row
  66.         int sixDots = n - 1;
  67.         int innerSixDots = n;
  68.         for (int i = 0; i < n-1; i++)
  69.         {
  70.             Console.WriteLine("{0}*{1}*{0}",
  71.                 new string(dot, sixDots), new string(dot, innerSixDots));
  72.             sixDots--;
  73.             innerSixDots += 2;
  74.  
  75.         }
  76.         // end six
  77.         Console.WriteLine("{0}",new string('*',widht));
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement