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