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