lmarkov

Forest Road

Dec 14th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 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 ForestRoad
  8. {
  9.     class ForestRoad
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int numberN = int.Parse(Console.ReadLine());
  14.             int starPosition = 1;
  15.             for (int j = 1; j <= (numberN * 2) - 1; j++)
  16.             {
  17.                 for (int k = 1; k <= numberN; k++)
  18.                 {
  19.                     if (starPosition == k)
  20.                     {
  21.                         Console.Write("*");
  22.                     }
  23.                     else
  24.                     {
  25.                         Console.Write(".");
  26.                     }                    
  27.                 }
  28.                 if (j < numberN)
  29.                 {
  30.                     starPosition++;
  31.                 }
  32.                 else
  33.                 {
  34.                     starPosition--;
  35.                 }
  36.                 Console.WriteLine();
  37.             }            
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment