题解 | #空心三角形图案#
空心三角形图案
https://www.nowcoder.com/practice/2ccc5fca423e47f0b622fe6f151cfab4
#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; }