题解 | #空心正方形图案#
空心正方形图案
https://www.nowcoder.com/practice/72347ee949dc47399186ee183632f303
#include <stdio.h> int main() { int a = 0; while (scanf("%d", &a) == 1) { for (int i = 1; i <= a; i++) { if (i == 1 || i == a) { for (int k = 1; k <= a; k++) printf("* "); } else { for (int j = 1; j <= a; j++) if (j == 1 || j == a) printf("* "); else printf(" "); } printf("\n"); } } return 0; }