#include <stdio.h>

int main() {
    int n;
    scanf('%d', &n);
    for (int i = 1; i <= n; i++) { // 控制行数
        for (int j = 1; j <= n - i; j++) { // 输出空格
            printf(' ');
        }
        for (int k = 1; k <= 2 * i - 1; k++) { // 输出*
            printf('*');
        }
        printf('\n'); // 换行
    }
    return 0;
}
C语言实现打印n行图形:左对齐的等腰三角形

原文地址: https://www.cveoy.top/t/topic/oJWC 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录