C++ Program to Print Inverted Right Triangle of Same Column Numbers

Write a C++ program to print the inverted right triangle of the same column numbers using for loop.

#include<iostream>
using namespace std;

int main()
{
	int i, j, rows;
     
    cout << "Enter Inverted Right Triangle of Numbers Rows = ";
    cin >> rows;

    cout << "Inverted Right Triangle of Same Column Numbers Pattern\n";  

    for(i = rows; i >= 1; i--)
    {
    	for(j = 1; j <= i; j++)
		{
            cout << i << " ";
        }
        cout << "\n";
    }		
 	return 0;
}
C++ Program to Print Inverted Right Triangle of Same Column Numbers

This C++ example example prints the inverted right angled triangle of the same column numbers using a while loop.

#include<iostream>
using namespace std;

int main()
{
	int i, j, rows;
     
    cout << "Enter Inverted Right Triangle of Numbers Rows = ";
    cin >> rows;

    cout << "Inverted Right Triangle of Same Column Numbers Pattern\n";
    
    i = rows;

    while( i >= 1)
    {
        j = 1;
    	while( j <= i)
		{
            cout << i << " ";
            j++;
        }
        cout << "\n";
        i--;
    }		
 	return 0;
}
Enter Inverted Right Triangle of Numbers Rows = 8
Inverted Right Triangle of Same Column Numbers Pattern
8 8 8 8 8 8 8 8 
7 7 7 7 7 7 7 
6 6 6 6 6 6 
5 5 5 5 5 
4 4 4 4 
3 3 3 
2 2 
1