static void Main(string[] args)
{
int n;
Console.WriteLine("Please input a number\n");
n = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i <=n; i++)
{
for(int j=n-i;j>0;j--)
Console.Write(" ");
for(int k=0;k<2*i-1;k++)
Console.Write("*");
Console.Write("\n");
}
for (int i = n-1; i >= 0; i--)
{
for (int j = n - i; j > 0; j--)
Console.Write(" ");
for (int k = 0; k < 2 * i - 1; k++)
Console.Write("*");
Console.Write("\n");
}
沒有留言:
張貼留言