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 static System.Console;
- namespace Problem_Solving
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int columnAbove = n - 2;
- int spaceAbove = 1;
- for (int i = 0; i < n; i++)
- {
- int col = i > (n / 2) ? columnAbove : 2 * i + 1;
- int space = i > (n / 2) ? spaceAbove : (n / 2) - i;
- for (int k = 0; k < space; k++)
- {
- Write(" ");
- }
- for (int j = 1; j <= col; j++)
- {
- Write("*");
- }
- WriteLine();
- if (i > (n / 2))
- {
- columnAbove -= 2;
- spaceAbove++;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement