KlimentHristov

Figure.Rock

Nov 28th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 KB | None | 0 0
  1. using System;
  2. class Rock
  3. {
  4.     static void Main()
  5.     {
  6.         int n = int.Parse(Console.ReadLine());
  7.  
  8.         int width = 3 * n;
  9.         int height = 2 * n;
  10.         char dot = '.';
  11.         char star = '*';
  12.  
  13.         // first row
  14.         Console.WriteLine("{0}{1}{0}",new string (dot,n),new string (star,n));
  15.         // end first
  16.  
  17.         // second row
  18.         int secondDots = n - 2;
  19.         int secondInnerDots = n + 2;
  20.         for (int i = 0; i < n/2; i++)
  21.         {
  22.             Console.WriteLine("{0}*{1}*{0}",
  23.                 new string(dot, secondDots),
  24.                 new string(dot, secondInnerDots));
  25.             secondDots -= 2;
  26.             secondInnerDots += 4;
  27.         }
  28.         // end second
  29.  
  30.         // third row
  31.         Console.WriteLine("*{0}*{1}*{0}*",
  32.             new string (dot,n-2),new string (dot,n));
  33.         // end third
  34.  
  35.         // four row
  36.         int fourDots = n-4;
  37.         int fourInnerDots = 1;
  38.         int fourUnchange = n;
  39.         for (int i = 0; i < n/2-1; i++)
  40.         {
  41.             Console.WriteLine("*{0}*{1}*{2}*{1}*{0}*",
  42.                 new string(dot,fourDots),
  43.                 new string (dot,fourInnerDots),
  44.                 new string (dot,fourUnchange));
  45.             fourDots -= 2;
  46.             fourInnerDots += 2;
  47.         }
  48.         // end four
  49.  
  50.         // five row
  51.         int fiveDots = n - 1;
  52.         int fiveInner = n;
  53.         for (int i = 0; i < n-1; i++)
  54.         {
  55.             Console.WriteLine("{0}*{1}*{0}",
  56.                 new string(dot, fiveDots), new string(dot, fiveInner));
  57.             fiveDots--;
  58.             fiveInner += 2;
  59.  
  60.         }
  61.         // end five
  62.         Console.WriteLine("{0}",new string (star,width));
  63.  
  64.  
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment