Console.WriteLine("请输入等腰三角形的行数:");
int a = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= a; i++)
{
for (int j = a - i; j > 0; j--)
{
Console.Write(" ");
}
for (int k = 0; k < 2 * i - 1; k++)
{
Console.Write("*");
}
Console.WriteLine();
}
Console.ReadKey();
网友评论