#include <stdio.h>
#include <stdlib.h>
int main()
{
int row,column,sum_row;
scanf("%d",&sum_row);
if(sum_row%2==0){
printf("输入错误程序退出.\n");
exit(1);
}
for(row=1;row<=sum_row/2+1;row++){
for(column=1;column<=sum_row;column++){
if(column==(sum_row+1)/2-(row-1)||column==(sum_row+1)/2+(row-1)){
printf("*");
continue;
}
printf(" ");
}
printf("\n");
}
for(row=sum_row/2+2;row<=sum_row;row++){
for(column=1;column<=sum_row;column++){
if(column==(sum_row+1)/2-(sum_row-row)||column==(sum_row+1)/2+sum_row-row){
printf("*");
continue;
}
printf(" ");
}
printf("\n");
}
return 0;
}
菱形图案(中间抽空)
最新推荐文章于 2024-11-09 21:51:15 发布