help inverting a right triangle

Hey everyone, i am tasked with modifying this code to invert the right triangle to make it look like this if i enter a height of 5
*****
****
***
**
*
I tried everything that i can think of, and still have no idea how to do it. Thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;
int main()

{
	char a;
	int b, c, d;
	cout << "designate sign";
	cin >> a;
	cout << "designate height";
	cin >> b;
	for (c = 1; c <= b; c++)
	{
		{

			for (d = 1; d <= c; d++) cout << a;
		}
		cout << "\n";
	}
	return 0;
}
  
1
2
3
4
5
6
7
for (c = 1; c <= b; c++)
{
	{
		for (d = 1; d <= c; d++) cout << a;
	}
	cout << "\n";
}


Should be :
1
2
3
4
for (c = b; c > 0; c--)
{
	for (d = 1; d <= c; d++) cout << a; cout << "\n";
}

Last edited on
Topic archived. No new replies allowed.