C++ Program to Print Right Triangle of Incremental Alphabets Pattern

Write a C++ program to print right triangle of incremental alphabets pattern using for loop.

#include<iostream>
using namespace std;

int main()
{
	int rows;

	cout << "Enter Right Triangle of Incremented Characters Rows = ";
	cin >> rows;

	cout << "Right Triangle of Incremented Row Characters Pattern\n";
	int alphabet = 65;

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

C++ program to print the right angled triangle of alphabets in incremental order pattern using a while loop.

#include<iostream>
using namespace std;

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

	cout << "Enter Right Triangle of Incremented Characters Rows = ";
	cin >> rows;

	cout << "Right Triangle of Incremented Row Characters Pattern\n";

	alphabet = 65;

	i = 0;
	while (i <= rows - 1)
	{
		j = i;
		while (j >= 0)
		{
			cout << char(alphabet + j) << " ";
			j--;
		}
		cout << "\n";
		i++;
	}
}
Enter Right Triangle of Incremented Characters Rows = 13
Right Triangle of Incremented Row Characters Pattern
A 
B A 
C B A 
D C B A 
E D C B A 
F E D C B A 
G F E D C B A 
H G F E D C B A 
I H G F E D C B A 
J I H G F E D C B A 
K J I H G F E D C B A 
L K J I H G F E D C B A 
M L K J I H G F E D C B A 

This C++ example displays the right angled triangle pattern of incremental alphabets or ascending order using the do while loop.

#include<iostream>
using namespace std;

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

	cout << "Enter Right Triangle of Incremented Characters Rows = ";
	cin >> rows;

	cout << "Right Triangle of Incremented Row Characters Pattern\n";

	alphabet = 65;

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

		} while (--j >= 0);

		cout << "\n";

	} while (++i <= rows - 1);
}
Enter Right Triangle of Incremented Characters Rows = 16
Right Triangle of Incremented Row Characters Pattern
A 
B A 
C B A 
D C B A 
E D C B A 
F E D C B A 
G F E D C B A 
H G F E D C B A 
I H G F E D C B A 
J I H G F E D C B A 
K J I H G F E D C B A 
L K J I H G F E D C B A 
M L K J I H G F E D C B A 
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 A 
P O N M L K J I H G F E D C B A 

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.