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