题目描述
输入一个高度h,输出一个高为h,上底边为h的梯形。
输入
一个整数h(1<=h<=1000)。
输出
h所对应的梯形。
样例输入
5
样例输出
*****
*******
*********
***********
*************
#include<iostream>
#include<string>
#include<string.h>
using namespace std;
int main() {
int h;
while(scanf("%d",&h)!=EOF){ //pay attention!
for(int i=0;i<h;i++){
for(int j=0;j<(h-i-1)*2;j++){
printf(" ");
}
for(int j=0;j<h+i*2;j++){
printf("*");
}
printf("\n");
}
}
return 0;
}
343

被折叠的 条评论
为什么被折叠?



