题解
2025-05-17 13:52:41
发布于:浙江
0阅读
0回复
0点赞
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for(int i = 1; i <= n; i++) {
// 打印前导空格
for(int j = 1; j <= n - i; j++) {
cout << " ";
}
// 打印星号
for(int k = 1; k <= 2 * i - 1; k++) {
cout << "*";
}
cout << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个