倒三角形
输入正整数n<=20,输出一个n层的倒三角形。
#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = n; i >= 1; i--)
{
for (int k = 1; k <= n - i; k++)
{
cout << " ";
}
for (int j = 1; j <= 2 * i - 1; j++)
{
cout << "#";
}
cout << endl;
}
}