psotirov

Forest Road

Dec 10th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2.  
  3. class ForestRoad
  4. {
  5.     static void Main()
  6.     {
  7.         int N = int.Parse(Console.ReadLine()); // reads map width
  8.         int i = 0; // iterator
  9.         int direction = 1; // initially the direction is to the right positive
  10.  
  11.         while (i >= 0) // Loop until Telerik position has been found
  12.         {
  13.             if (i > 0) Console.Write(new string('.', i)); // leading points
  14.             Console.WriteLine("*"+ new string('.', N-i-1)); // path symbol ("*") and trailing points
  15.             if (i == (N-1)) direction = -1; // if right corner has been reached, reverses the direction
  16.             i += direction;
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment