Advertisement
APXOHT

Untitled

Nov 23rd, 2012
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 KB | None | 0 0
  1. using System;
  2.  
  3. class FirTree
  4. {
  5.     static void Main()
  6.     {
  7.         int N = int.Parse(Console.ReadLine());
  8.         for (int i = 1; i <= N; i++)
  9.         {
  10.             if (i < N)
  11.             {
  12.                 for (int j = N - 1; j > 0; j--)
  13.                 {
  14.                     if (i >= j)
  15.                     {
  16.                         Console.Write("*");
  17.                     }
  18.                     else
  19.                     {
  20.                         Console.Write(".");
  21.                     }
  22.                 }
  23.  
  24.                 for (int k = 1; k < N - 1; k++)
  25.                 {
  26.                     if (i > k)
  27.                     {
  28.                         Console.Write("*");
  29.                     }
  30.                     else
  31.                     {
  32.                         Console.Write(".");
  33.                     }
  34.                 }
  35.             }
  36.             else
  37.             {
  38.                 for (int j = 1; j <= N*2 - 3; j++)
  39.                 {
  40.                     if (j == N - 1)
  41.                     {
  42.                         Console.Write("*");
  43.                     }
  44.                     else
  45.                     {
  46.                         Console.Write(".");
  47.                     }
  48.                 }
  49.             }
  50.             Console.WriteLine();
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement