#include <iostream>
using namespace std;
int main()
{
int n, c, d;
int b = -1;
cin >> n;
while (n > 0)
{
b += 1;
c = b;
d = n;
while (c > 0)//输出倒金字塔每行前面的空格
{
cout << " ";
c--;
}
while (d > 0)//输出倒金字塔每行的"1 "
{
cout << 1 << ' ';
if (d == 1)
{
cout << '\n';
}
d--;
}
n--;
}
}
c++输出n层倒金字塔
最新推荐文章于 2024-12-03 14:23:31 发布