# C++ Program to Print Triangle of Numbers in Reverse Pattern

Write a C++ program to print triangle of numbers in reverse pattern using for loop.

```#include<iostream>
using namespace std;

int main()
{
int rows;

cout << "Enter Triangle of Numbers in Reverse Rows = ";
cin >> rows;

cout << "Triangle of Numbers in Reverse Order Pattern\n";

for (int i = rows; i >= 1; i--)
{
for (int j = 1; j < i; j++)
{
cout << " ";
}
for (int k = i; k <= rows; k++)
{
cout <<  k << " ";
}
cout << "\n";
}
}```

C++ program to print the triangle of numbers in reverse pattern using a while loop.

```#include<iostream>
using namespace std;

int main()
{
int i, j, k, rows;

cout << "Enter Rows = ";
cin >> rows;

cout << "Triangle of Numbers in Reverse Order Pattern\n";
i = rows;

while (i >= 1)
{
j = 1;
while (j < i)
{
cout << " ";
j++;
}

k = i;
while (k <= rows)
{
cout << k << " ";
k++;
}

cout << "\n";
i--;
}
}```
``````Enter Rows = 9
Triangle of Numbers in Reverse Order Pattern
9
8 9
7 8 9
6 7 8 9
5 6 7 8 9
4 5 6 7 8 9
3 4 5 6 7 8 9
2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 ``````

This C++ example displays the triangle pattern of numbers in descending order or reverse order using the do while loop.

```#include<iostream>
using namespace std;

int main()
{
int i, j, k, rows;

cout << "Enter Rows = ";
cin >> rows;

cout << "\n";
i = rows;

do
{
j = 1;
do
{
cout << " ";

} while (j++ < i);

k = i;
do
{
cout << k << " ";

} while (++k <= rows);

cout << "\n";

} while (--i >= 1);
}```
``````Enter Rows = 10

10
9 10
8 9 10
7 8 9 10
6 7 8 9 10
5 6 7 8 9 10
4 5 6 7 8 9 10
3 4 5 6 7 8 9 10
2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10 ``````