#include<stdio.h>
int main()
{
int n;
scanf("%d", &n);
int a = (n + 1) / 2;
int h1 = 1, h2 = 1;
int m1 = 1, m2 = 1;
for (int i1 = a - 1; i1 > 0; i1--) {
for (int j1 = 0; j1 < i1; j1++) printf(" ");
for (int k1 = 0; k1 < m1; k1++) printf("* ");
printf("\n");
m1 = h1 * 2 + 1;
h1++;
}
for (int i = 0; i < a * 2 - 1; i++) printf("* ");
printf("\n");
for (int i2 = a - 1; i2 > 0; i2--) {
for (int j2 = 0; j2 < h2; j2++) printf(" ");
h2++;
m2 = i2 * 2 - 1;
for (int k2 = 0; k2 < m2; k2++) printf("* ");
printf("\n");
}
}
7-59 打印菱形图案
最新推荐文章于 2024-11-08 17:13:17 发布