C++ Program to Print Downward Triangle Alphabets Pattern

Write a C++ program to print downward triangle alphabets pattern using for loop.

#include<iostream>
using namespace std;

int main()
{
	int rows, alphabet = 65;

	cout << "Enter Downward Triangle of Alphabets Rows = ";
	cin >> rows;

	cout << "Printing Downward Triangle of Alphabets Pattern\n";
	for (int i = 0; i <= rows - 1; i++)
	{
		for (int j = rows - 1; j >= i; j--)
		{
			cout << char(alphabet + j) << " ";
		}
		cout << "\n";
	}
}
C++ Program to Print Downward Triangle Alphabets Pattern

C++ program to print downward triangle alphabets pattern using a while loop

#include<iostream>
using namespace std;

int main()
{

	int i, j, rows, alphabet = 65;

	cout << "Enter Downward Triangle of Alphabets Rows = ";
	cin >> rows;

	cout << "Printing Downward Triangle of Alphabets Pattern\n";

	i = 0;
	while (i <= rows - 1)
	{
		j = rows - 1;
		while (j >= i)
		{
			cout << char(alphabet + j) << " ";
			j--;
		}
		cout << "\n";
		i++;
	}
}
Enter Downward Triangle of Alphabets Rows = 12
Printing Downward Triangle of Alphabets Pattern
L K J I H G F E D C B A 
L K J I H G F E D C B 
L K J I H G F E D C 
L K J I H G F E D 
L K J I H G F E 
L K J I H G F 
L K J I H G 
L K J I H 
L K J I 
L K J 
L K 
L 

This C++ example displays the downward triangle pattern of alphabets using a do while loop.

#include<iostream>
using namespace std;

int main()
{

	int i, j, rows, alphabet = 65;

	cout << "Enter Downward Triangle of Alphabets Rows = ";
	cin >> rows;

	cout << "Printing Downward Triangle of Alphabets Pattern\n";

	i = 0;
	do
	{
		j = rows - 1;
		do
		{
			cout << char(alphabet + j) << " ";

		} while (--j >= i);
		cout << "\n";

	} while (++i <= rows - 1);
}
Enter Downward Triangle of Alphabets Rows = 15
Printing Downward Triangle of Alphabets Pattern
O N M L K J I H G F E D C B A 
O N M L K J I H G F E D C B 
O N M L K J I H G F E D C 
O N M L K J I H G F E D 
O N M L K J I H G F E 
O N M L K J I H G F 
O N M L K J I H G 
O N M L K J I H 
O N M L K J I 
O N M L K J 
O N M L K 
O N M L 
O N M 
O N 
O