#include <stdio.h> int main() { int i = 0, j = 0, n = 0; while (scanf("%d", &n) != EOF) { for (i = 1; i < n + 1; i++)//控制行数 { for (j = 1; j <=i; j++) { printf("%d ",j );//打印每一行 } printf("\n"); } } return 0; }
#include <stdio.h> int main() { int i = 0, j = 0, n = 0; while (scanf("%d", &n) != EOF) { for (i = 1; i < n + 1; i++)//控制行数 { for (j = 1; j <=i; j++) { printf("%d ",j );//打印每一行 } printf("\n"); } } return 0; }