A324.打印金字塔
2025-01-05 17:40:10
发布于:江苏
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 j=1;j<=2*i-1;j++) cout<<'*';
cout<<'\n';
}
return 0;
}
这里空空如也
有帮助,赞一个