Write a C++ program to print inverted right triangle of numbers in reverse order using for loop.
#include<iostream> using namespace std; int main() { int i, j, rows; cout << "Enter Inverted Right Triangle of Nums in Reverse Rows = "; cin >> rows; cout << "Inverted Right Triangle of Numbers in Reverse Order Pattern\n"; for(i = 1; i <= rows; i++) { for(j = rows; j >= i; j--) { cout << j << " "; } cout << "\n"; } return 0; }

This C++ example example displays the inverted right triangle where its numbers print in reverse order using a while loop.
#include<iostream> using namespace std; int main() { int i, j, rows; cout << "Enter Inverted Right Triangle of Nums in Reverse Rows = "; cin >> rows; cout << "Inverted Right Triangle of Numbers in Reverse Order Pattern\n"; i = 1; while( i <= rows) { j = rows; while( j >= i) { cout << j << " "; j--; } cout << "\n"; i++; } return 0; }
Enter Inverted Right Triangle of Nums in Reverse Rows = 13
Inverted Right Triangle of Numbers in Reverse Order Pattern
13 12 11 10 9 8 7 6 5 4 3 2 1
13 12 11 10 9 8 7 6 5 4 3 2
13 12 11 10 9 8 7 6 5 4 3
13 12 11 10 9 8 7 6 5 4
13 12 11 10 9 8 7 6 5
13 12 11 10 9 8 7 6
13 12 11 10 9 8 7
13 12 11 10 9 8
13 12 11 10 9
13 12 11 10
13 12 11
13 12
13