Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- namespace ConsoleApp5
- {
- class Program
- {
- static void Main(string[] args)
- {
- DrawPyramide(10);
- Thread.Sleep(5000);
- Console.Clear();
- DrawPyramide(5);
- Thread.Sleep(5000);
- Console.Clear();
- DrawPyramide(7);
- Thread.Sleep(5000);
- Console.Clear();
- DrawPyramide(11);
- }
- static void DrawPyramide(int pyramideSize)
- {
- if (pyramideSize >= 10)
- {
- pyramideSize = 1;
- }
- for (int x = 0; x < (pyramideSize * 2); x++)
- {
- for (int y = 0; y < (pyramideSize * 2); y++)
- {
- Console.SetCursorPosition(x, y);
- int min = x < y ? x : y;
- int max = x > y ? x : y;
- if (x + y < (pyramideSize * 2))
- {
- Console.Write(min + 1);
- }
- else
- {
- Console.Write((pyramideSize * 2) - max);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement