1、

#include <stdio.h>

int main(void)
{
    int i, j, len;
    puts("please input the len.");
    printf("len = "); scanf("%d", &len);
    
    for (i = 1; i <= len; i ++)
    {
        for (j = 1; j <= (2 * len - 1) / 2 + 1 - i; j ++ )
        {
            putchar(' ');
        }
        for (j = 1; j <= 2 * i -1; j ++ )
        {
            putchar('*');
        }
        for (j = 1; j <= (2 * len + 1 - i); j ++)
        {
            putchar(' ');
        }
        putchar('\n');
    }
    return 0;
} 

c语言中绘制金字塔_C语言

 

#include <stdio.h>

int main(void)
{
    int i, j, len;
    puts("please input the len.");
    printf("len = "); scanf("%d", &len);
    
    for (i = 1; i <= len; i ++)
    {
        for (j = 1; j <= (2 * len -1) / 2 + 1 - i; j ++)
        {
            putchar(' ');
        }
        for (j = 1; j <= 2 * i - 1; j ++ )
        {
            printf("%d", i);
        }
        putchar('\n');
    }
    return 0;
}

c语言中绘制金字塔_#include_02