Siropo

Forest Road

Dec 31st, 2012
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.43 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()
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             bool star = true;
  15.             int count = 1;
  16.             for (int i = 1; i <= n; i++)
  17.             {
  18.                 for (int j = 1; j <= n; j++)
  19.                 {
  20.                     if (star && count == j)
  21.                     {
  22.                         Console.Write('*');
  23.                         star = false;
  24.                     }
  25.                     else
  26.                     {
  27.                         Console.Write('.');
  28.                     }
  29.                 }
  30.                 count++;
  31.                 star = true;
  32.                 Console.WriteLine();
  33.             }
  34.             count = 1;
  35.             for (int i = n - 1; i >= 1; i--)
  36.             {
  37.                 for (int j = n - 1; j >= 0; j--)
  38.                 {
  39.                     if (star && count == j)
  40.                     {
  41.                         Console.Write('*');
  42.                         star = false;
  43.                     }
  44.                     else
  45.                     {
  46.                         Console.Write('.');
  47.                     }
  48.                 }
  49.                 count++;
  50.                 star = true;
  51.                 Console.WriteLine();
  52.             }
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment