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

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

#include<iostream>
using namespace std;

int main()
{
	int rows;

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

	cout << "Right Triangle of Consecutive Alphabets Pattern\n";
	int alphabet = 65;

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

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

#include<iostream>
using namespace std;

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

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

	cout << "Right Triangle of Consecutive Alphabets Pattern\n";
	alphabet = 65;

	i = 0;

	while (i <= rows - 1)
	{
		j = 0;

		while (j <= i)
		{
			cout << char(alphabet++) << " ";
			j++;
		}
		cout << "\n";
		i++;
	}
}
Enter Right Triangle of Consecutive Alphabets Rows = 9
Right Triangle of Consecutive Alphabets Pattern
A 
B C 
D E F 
G H I J 
K L M N O 
P Q R S T U 
V W X Y Z [ \ 
] ^ _ ` a b c d 
e f g h i j k l m 

This C++ example displays the right angled triangle pattern of consecutive alphabets in each column using the do while loop.

#include<iostream>
using namespace std;

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

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

	cout << "Right Triangle of Consecutive Alphabets Pattern\n";
	alphabet = 65;

	i = 0;

	do
	{
		j = 0;

		do
		{
			cout << char(alphabet++) << " ";

		} while (++j <= i);

		cout << "\n";

	} while (++i <= rows - 1);
}
Enter Right Triangle of Consecutive Alphabets Rows = 10
Right Triangle of Consecutive Alphabets Pattern
A 
B C 
D E F 
G H I J 
K L M N O 
P Q R S T U 
V W X Y Z [ \ 
] ^ _ ` a b c d 
e f g h i j k l m 
n o p q r s t u v w