using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter
the number: ");
int num = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i
<= num; i++)
{
Console.WriteLine("");
for (int
j = 1; j <= i; j++)
{
Console.Write("*");
}
for (int
k = num; k >= i; k--)
{
Console.Write(" ");
}
for (int
l = num; l >= i + 1; l--)
{
Console.Write(" ");
}
for (int
m = 1; m <= i; m++)
{
Console.Write("*");
}
}
Console.ReadKey();
}
}
}
Output:
Enter the number :5
* *
** **
*** ***
**** ****
***** *****
No comments:
Post a Comment