int n = convert.toint32(console.readline());
for (int i = 1; i < n; i++)
{
for (int j = 0; j < n - i; j++)
{
console.write(" ");
}
for (int j = 0; j < 2 * i - 1; j++)
{
console.write("*");
}
console.writeline("");
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < i; j++)
{
console.write(" ");
}
for (int j = 0; j < (n - i) * 2 - 1; j++)
{
console.write("*");
}
console.writeline("");
}
c#学习笔记-嵌套循环(菱形)
于 2023-06-03 10:20:18 首次发布