当输入一个整数时,打印的图形如下:

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;
}

 

posted on 2021-03-05 14:16  ScottJS  阅读(817)  评论(0)    收藏  举报