当输入一个整数时,打印的图形如下:
1
2 3
4 5 6
7 8 9 10
......
#include<stdio.h> #include<stdlib.h> int main() { int a=1, b,n,c=1; scanf("%d", &n); while (a <= n) { b = 1; while (b <= a) { printf("%d ",c); c++; b++; } printf("\n"); a++; } return 0; }