C++ Program to Print Right Triangle of Repeated Characters

Write a C++ program to print the repeated alphabets or characters in each right triangle row using for loop.

#include<iostream>
using namespace std;

int main()
{
	int i, j, alphabet, rows;
     
    cout << "Enter Right Triangle Repeated Alphabets Pattern Rows = ";
    cin >> rows;

    cout << "Right Angled Triangle of Repeated Alphabets Pattern\n"; 

    alphabet = 65;

    for(i = 0; i < rows; i++)
    {
    	for(j = 0; j <= i; j++)
		{
            cout << char(alphabet) << " ";
        }
        alphabet++;
        cout << "\n";
    }		
 	return 0;
}
C++ Program to Print Right Triangle of Repeated Characters

This C++ example example displays the right triangle pattern of repeated characters in each row using a while loop.

#include<iostream>
using namespace std;

int main()
{
	int i = 0, j, alphabet, rows;
     
    cout << "Enter Right Triangle Repeated Alphabets Pattern Rows = ";
    cin >> rows;

    cout << "Right Angled Triangle of Repeated Alphabets Pattern\n"; 

    alphabet = 65;

    while(i < rows)
    {
        j = 0;
    	while( j <= i)
		{
            cout << char(alphabet) << " ";
            j++;
        }
        alphabet++;
        cout << "\n";
        i++;
    }		
 	return 0;
}
Enter Right Triangle Repeated Alphabets Pattern Rows = 15
Right Angled Triangle of Repeated Alphabets Pattern
A 
B B 
C C C 
D D D D 
E E E E E 
F F F F F F 
G G G G G G G 
H H H H H H H H 
I I I I I I I I I 
J J J J J J J J J J 
K K K K K K K K K K K 
L L L L L L L L L L L L 
M M M M M M M M M M M M M 
N N N N N N N N N N N N N N 
O O O O O O O O O O O O O O O