Advertisement
EndymionSpr

Choinka5

Oct 18th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.27 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. //Program wydaje mi się za długi i raczej powinien być podzielony na osobne funkcje
  7. //ale pewnie nie będziemy mogli tak pisać jeszcze w tym zadaniu.
  8. namespace ConsoleApp1
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int linie;
  15.             Console.WriteLine("Wprowadź wysokość : ");
  16.             string str = Console.ReadLine();
  17.             linie = Convert.ToInt32(str);
  18.             int sum = linie - 1;
  19.             for (int i = 0; i < linie; i++)
  20.             {
  21.                 for (int j = 0; j < linie - i - 1; j++)
  22.                 {
  23.                     Console.Write(" ");
  24.                 }
  25.  
  26.                 for (int x = 0; x < i * 2 + 1; x++)
  27.                 {
  28.  
  29.                     Console.Write("*");
  30.                 }
  31.                 Console.WriteLine();
  32.             }
  33.             int e = 0;
  34.            
  35.             while (e!=2)
  36.             {
  37.                 for (int c = 0; c < sum; c++)
  38.                 {
  39.                     Console.Write(" ");
  40.                 }
  41.                 Console.WriteLine("|"); e++;
  42.             }
  43.            
  44.             Console.ReadKey();
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement