#include <stdio.h> int main() { int n = 0; while (scanf("%d", &n) != EOF) { int i,j = 0; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (j == 0 || i == n - 1 || j == i) { printf("* "); } else { printf(" "); } } printf("\n"); } } return 0; }
#include <stdio.h> int main() { int n = 0; while (scanf("%d", &n) != EOF) { int i,j = 0; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (j == 0 || i == n - 1 || j == i) { printf("* "); } else { printf(" "); } } printf("\n"); } } return 0; }