Write a C++ program to print mirrored right triangle alphabets pattern using for loop.
#include<iostream>
using namespace std;
int main()
{
int rows;
cout << "Enter Mirrored Right Triangle of Alphabets Rows = ";
cin >> rows;
cout << "The Mirrored Right Triangle Alphabets Pattern\n";
int alphabet = 65;
for (int i = 0; i <= rows; i++)
{
for (int j = 1; j <= rows - i; j++)
{
cout << " ";
}
for (int k = 0; k <= i; k++)
{
cout << char(alphabet + i);
}
cout << "\n";
}
}

C++ program to print mirrored right triangle alphabets pattern using a while loop.
#include<iostream>
using namespace std;
int main()
{
int rows, i, j, k, alphabet;
cout << "Enter Mirrored Right Triangle of Alphabets Rows = ";
cin >> rows;
cout << "The Mirrored Right Triangle Alphabets Pattern\n";
alphabet = 65;
i = 0;
while (i <= rows)
{
j = 1;
while (j <= rows - i)
{
cout << " ";
j++;
}
k = 0;
while (k <= i)
{
cout << char(alphabet + i);
k++;
}
cout << "\n";
i++;
}
}
Enter Mirrored Right Triangle of Alphabets Rows = 14
The Mirrored Right Triangle Alphabets Pattern
A
BB
CCC
DDDD
EEEEE
FFFFFF
GGGGGGG
HHHHHHHH
IIIIIIIII
JJJJJJJJJJ
KKKKKKKKKKK
LLLLLLLLLLLL
MMMMMMMMMMMMM
NNNNNNNNNNNNNN
OOOOOOOOOOOOOOO
This C++ example displays the mirrored right angled triangle pattern of alphabets using a do while loop.
#include<iostream>
using namespace std;
int main()
{
int rows, i, j, k, alphabet;
cout << "Enter Mirrored Right Triangle of Alphabets Rows = ";
cin >> rows;
cout << "The Mirrored Right Triangle Alphabets Pattern\n";
alphabet = 65;
i = 0;
do
{
j = 1;
do
{
cout << " ";
} while (j++ <= rows - i);
k = 0;
do
{
cout << char(alphabet + i);
} while (++k <= i);
cout << "\n";
} while (++i < rows);
}
Enter Mirrored Right Triangle of Alphabets Rows = 17
The Mirrored Right Triangle Alphabets Pattern
A
BB
CCC
DDDD
EEEEE
FFFFFF
GGGGGGG
HHHHHHHH
IIIIIIIII
JJJJJJJJJJ
KKKKKKKKKKK
LLLLLLLLLLLL
MMMMMMMMMMMMM
NNNNNNNNNNNNNN
OOOOOOOOOOOOOOO
PPPPPPPPPPPPPPPP
QQQQQQQQQQQQQQQQQ