等腰梯形 Posted on 2020-11-25 Edited on 2021-04-14 In 算法笔记 Views: 题目描述:请输入高度h,输入一个高为h,上底边长为h 的等腰梯形(例如h=4,图形如下)。 1234 **** ****** ****************** 输入格式:输入第一行表示样例数m,接下来m行每行一个整数h,h不超过10。 输出格式:对应于m个case输出要求的等腰梯形。 输入样例:14 输出样例: 1234 **** ****** ****************** train of thought: code: 12345678910111213141516171819#include <bits/stdc++.h>int main(){ int h; scanf("%d", &h); for (int i = 1; i <= h; i++) { for (int j = 1; j <= h - i; j++) { printf(" "); } for (int k = 1; k <= h + 2 * (i - 1); k++) { printf("*"); } printf("\n"); } return 0;} Post author: SRP05 Post link: https://srp05.github.io/2020/11/25/等腰梯形/ Copyright Notice: All articles in this blog are licensed under BY-NC-SA unless stating additionally.