Advertisement
ivan_yosifov

Forest_Road

Nov 11th, 2013
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         int N = int.Parse(Console.ReadLine());
  8.         int height = N * 2 - 1;
  9.         int leftDots = 0;
  10.         int rightDots = 0;
  11.         string row = null;
  12.  
  13.         for (int i = 0; i < height; i++)
  14.         {
  15.             if (i <= height / 2)
  16.             {
  17.                 leftDots = i;
  18.                 rightDots = N - i - 1;
  19.                 row = new string('.', leftDots);
  20.                 row += '*';
  21.                 row += new string('.', rightDots);
  22.                 Console.WriteLine(row);
  23.             }
  24.             else
  25.             {
  26.                 leftDots = height - i - 1;
  27.                 rightDots = i - (height / 2);
  28.                 row = new string('.', leftDots);
  29.                 row += "*";
  30.                 row += new string('.', rightDots);
  31.                 Console.WriteLine(row);
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement