Advertisement
Svetli0o

Telerik logo

Apr 11th, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TelerikLogo
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int x = int.Parse(Console.ReadLine());
  14.             int z = x / 2 + 1;
  15.             int width = 2 * x + 2 * z - 3;
  16.             int height = x * 3 - 2;
  17.             int counterForZ = z - 1;
  18.             int positionX = z;
  19.             for (int i = 0; i < height; i++)
  20.             {
  21.                 for (int j = 0; j < width; j++)
  22.                 {
  23.                     if (j == counterForZ || j == width - counterForZ - 1)
  24.                     {
  25.                         Console.Write('*');
  26.                     }
  27.                     else if ((j == positionX || j == width - positionX - 1) && i != 0)
  28.                     {
  29.                         Console.Write('*');
  30.                     }
  31.                     else
  32.                     {
  33.                         Console.Write('.');
  34.                     }
  35.                 }
  36.                 Console.WriteLine();
  37.                 if (i > 0 && i < height - x)
  38.                 {
  39.                     positionX++;
  40.                 }
  41.                 else if (i > 0)
  42.                 {
  43.                     positionX--;
  44.                 }
  45.                 counterForZ--;
  46.             }
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement