Advertisement
aggressiveviking

07.ChristmasTree

Mar 3rd, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _07.ChristmasTree
  4. {
  5.     class ChristmasTree
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             for (int i = 0; i <= n; i++)
  12.             {
  13.                 var stars = new string('*', i);
  14.                 var spaces = new string(' ', n-i);
  15.  
  16.                 Console.Write(spaces);
  17.                 Console.Write(stars);
  18.                 Console.Write(" | ");
  19.                 Console.Write(stars);
  20.                 Console.WriteLine(spaces);
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement