grach

ChristmassTree

Jul 19th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 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 Christmas_Tree
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             Console.Write(new string(' ', n));
  15.             Console.WriteLine(" |");
  16.  
  17.             /* for (int i = 1; i <= n; i++)
  18.              {
  19.                  Console.Write(new string(' ', n-i));
  20.                  Console.Write(new string('*', i));
  21.                  Console.Write(" ");
  22.                  Console.Write("|");
  23.                  Console.Write(" ");
  24.                  Console.WriteLine(new string('*', i));
  25.              }
  26.              */
  27.  
  28.             //можем да опишем структурата с place holder:
  29.  
  30.             for (int i = 1; i <= n; i++)
  31.             {
  32.                 Console.WriteLine("{0}{1} | {1}", new string(' ', n - i), new string('*', i));
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment