Venciity

[SoftUni C# exam preparation] Telerik Logo

Apr 1st, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Text;
  3.  
  4. class TelerikLogo
  5. {
  6.     static void Main()
  7.     {
  8.         int X = int.Parse(Console.ReadLine());
  9.         int Y = X;
  10.         int Z = (X + 1) / 2;
  11.  
  12.         int Width = 3 * X - 2;
  13.  
  14.         for (int i = 0; i < 2 * X - 2; i++)
  15.         {
  16.             StringBuilder line = new StringBuilder(new string('.', Width));
  17.  
  18.             if (Z - 1 - i >= 0)
  19.             {
  20.                 line[Z - 1 - i] = '*';
  21.             }
  22.             line[Z - 1 + i] = '*';
  23.  
  24.             line[Width - Z - i] = '*';
  25.             if (Width - Z + i < Width)
  26.             {
  27.                 line[Width - Z + i] = '*';
  28.             }
  29.  
  30.             Console.WriteLine(line);
  31.         }
  32.  
  33.         for (int i = 0; i < X; i++)
  34.         {
  35.             StringBuilder line = new StringBuilder(new string('.', Width));
  36.             line[Z - 1 + i] = '*';
  37.             line[Width - Z - i] = '*';
  38.             Console.WriteLine(line);
  39.         }
  40.     }
  41. }
Add Comment
Please, Sign In to add comment