using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace piramid
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter a number: ");
int n = Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
for (int i = n; i > 1; i--)
{
for (int j = 1; j <= i; j++)
Console.Write("*");
Console.WriteLine();
}
for (int i = 0; i <= n; i++)
{
for (int j = 1; j <= i; j++)
Console.Write("*");
Console.WriteLine();
}
Console.WriteLine();
for (int i = 1; i < n; i++)
{
for (int j = 1; j <= i; j++)
Console.Write(j.ToString());
Console.WriteLine();
}
for (int i = n; i >= 0; i--)
{
for (int j = 1; j <= i; j++)
Console.Write(j.ToString());
Console.WriteLine();
}
Console.WriteLine();
Console.ReadLine();
}
}
}
OUTPUT:
No comments:
Post a Comment