Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.66 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 ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.            
  14.             {
  15.                 Console.BackgroundColor = ConsoleColor.DarkGray;
  16.  
  17.                 Console.Clear();
  18.  
  19.                 uint wysokość;
  20.                 Console.WriteLine("Podaj wysokość choinki");
  21.                 while (true)
  22.                 {
  23.                     if (uint.TryParse(Console.ReadLine(), out wysokość) == true) break;
  24.                     Console.WriteLine("Błędna liczba, spróbuj ponownie");
  25.                 }
  26.                
  27.                 Console.ForegroundColor = ConsoleColor.Green;
  28.                 Console.Clear();
  29.                 for (uint u = 0; u < wysokość; ++u)
  30.                 {
  31.                     for (uint u1 = u; u1+1 < wysokość; ++u1)
  32.                         Console.Write(" ");
  33.                    
  34.                     for (uint u1 = 0; u1 <= 2*u; ++u1)
  35.                     {
  36.                         Console.Write("*");
  37.                     }
  38.                     Console.WriteLine();
  39.                 }
  40.  
  41.  
  42.                 Console.ForegroundColor = ConsoleColor.Magenta;
  43.                 for (uint u1 = 0 ; u1 + 1 < wysokość; ++u1){
  44.                     Console.Write(" ");
  45.                 }
  46.                 Console.WriteLine("|");
  47.                 for (uint u1 = 0; u1 + 1 < wysokość; ++u1)
  48.                 {
  49.                     Console.Write(" ");
  50.                 }
  51.                 Console.WriteLine("|");
  52.                
  53.  
  54.             }
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement