C++ Program to Print Triangle Alphabets Pattern

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

#include<iostream>
using namespace std;

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

    cout << "Triangle of Alphabets/Characters Pattern\n"; 

    for(i = 0; i < rows; i++)
    {
        alphabet = 65;
        for(j = rows; j > i; j--)
        {
            cout << " ";
        }
    	for(k = 0; k <= i; k++)
		{
            cout << char(alphabet + k) << " ";
        }
        cout << "\n";
    }		
 	return 0;
}
CPP Program to Print Triangle Alphabets Pattern

This C++ example displays the alphabets in a triangle pattern using a while loop.

#include<iostream>
using namespace std;

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

    cout << "Triangle of Alphabets/Characters Pattern\n"; 

    while(i < rows)
    {
        alphabet = 65;
        j = rows;
        while( j > i)
        {
            cout << " ";
            j--;
        }
        k = 0;
    	while( k <= i)
		{
            cout << char(alphabet + k) << " ";
            k++;
        }
        cout << "\n";
        i++;
    }		
 	return 0;
}
Enter Triangle Alphabets Pattern Row = 15
Triangle of Alphabets/Characters Pattern
               A 
              A B 
             A B C 
            A B C D 
           A B C D E 
          A B C D E F 
         A B C D E F G 
        A B C D E F G H 
       A B C D E F G H I 
      A B C D E F G H I J 
     A B C D E F G H I J K 
    A B C D E F G H I J K L 
   A B C D E F G H I J K L M 
  A B C D E F G H I J K L M N 
 A B C D E F G H I J K L M N O