Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Pyramidi
- {
- class Ohjelma
- {
- static void Main()
- {
- int maxHeight = 0;
- do
- {
- Console.Write("Anna korkeus: ");
- maxHeight = Convert.ToInt32(Console.ReadLine());
- if (maxHeight > 0)
- {
- break;
- }
- else
- {
- continue;
- }
- }
- while (true);
- for (int height = 0; height < maxHeight; height++)
- {
- for (int i = 0; i < (maxHeight - height - 1); i++)
- {
- Console.Write(" ");
- }
- for (int i = 1; i <= (height * 2 + 1); i++)
- {
- Console.Write("*");
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement