//打印倒三角
#include<stdio.h>
int main(){
int m,n,max,t;
int temp,tempp,N;
scanf("%d",&N);
while(N--){
scanf("%d",&n);
max = (n-1)*2+1;
int temppp = max;
int y = n+1;
while(n--){
temp = (y-2)*2 + 1;
if(temp < max){
tempp = (max-temp)/2;
while(tempp--){
printf(" ");
}
while(temp--){
printf("*");
}
}
else{
while(temppp--){
printf("*");
}
}
printf("\n");
y--;
}
}
return 0;
}
C语言输出/打印倒三角型
最新推荐文章于 2023-11-25 11:57:34 发布