Advertisement
Asinka

Forest Road

Oct 30th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4.  
  5. class ForestRoad
  6. {
  7.     static void Main()
  8.     {
  9.         Console.WriteLine("n = ");
  10.         int widthOfMapN = int.Parse(Console.ReadLine());
  11.         char asterisk = '*';
  12.         char trees = '.';
  13.  
  14.  
  15.         for (int countUp = 0, countDown = widthOfMapN; countUp < widthOfMapN; countUp++, countDown--)
  16.         {
  17.             for (int h = 0; h < countUp; h++)
  18.             {
  19.                 Console.Write(trees);
  20.             }
  21.             Console.Write(asterisk);
  22.  
  23.             for (int j = 0; j < countDown - 1; j++)
  24.             {
  25.                 Console.Write(trees);
  26.             }
  27.             Console.WriteLine();
  28.         }
  29.  
  30.  
  31.         for (int countUp = 1, countDown = widthOfMapN - 1; countUp < widthOfMapN; countUp++, countDown--)
  32.         {
  33.             for (int h = 0; h < countDown - 1; h++)
  34.             {
  35.                 Console.Write(trees);
  36.             }
  37.             Console.Write(asterisk);
  38.  
  39.             for (int h = 0; h < countUp; h++)
  40.             {
  41.                 Console.Write(trees);
  42.             }
  43.             Console.WriteLine();
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement