1 #include<stdio.h> 2 3 int main(void) 4 { 5 int n; 6 7 scanf_s("%d", &n); 8 9 for (int i = 1; i <= n / 2; i++) 10 { 11 for (int j = i; j <= n / 2; j++) 12 { 13 printf(" "); 14 } 15 for (int j = 1; j <= i * 2 - 1; j++) 16 { 17 printf("* "); 18 } 19 printf(" "); 20 } 21 22 for (int i = 1; i <= n; i++) 23 { 24 printf("* "); 25 } 26 printf(" "); 27 28 for (int i = 1; i <= n/2; i++) 29 { 30 for (int j = i; j <= i * 2 - 1; j++) 31 { 32 printf(" "); 33 } 34 for (int j = 1; j <= n - i * 2; j++) 35 { 36 printf("* "); 37 } 38 printf(" "); 39 } 40 41 return 0; 42 }