August 25, 2022 |3.5K Views

    C++ Program to Print Triangular Patterns of Alphabets

    Description
    Discussion

    In this video, we will write a C++ program to print triangular patterns of alphabets using for loop. 

    We will be printing various alphabetic pattern pyramid: 
    1) Left half pyramid 
    2) Reverse left pyramid 
    3) Complete pyramid
    4) Reverse complete pyramid 
    5) Right half pyramid 
    6) Reverse right half pyramid 
    7) Different ordering of alphabets +edge case. 

    Algorithm: 
    Step 1: Initialization of variables. 
    Step 1.1: Create variables in memory holding rows and columns. 
    Step 1.2: Create and initialize variable holding patterns or values to be displayed. 

    Step 2. Traversing over rows and columns using nested for loops. 
    Step 2.1: Outer loop for rows. 
    Step 2.2: Inner loop for columns in the current row. 

    Step 3: Dealing with variable holding dynamic values as per execution as initialized outside nested loops. 
    Step 3.1: If values are to be displayed, increment this variable inside the loop for rows and outside loop for columns. 
    Step 3.2: If patterns are to be displayed, assign the character outside loop while creation and no alternation of holder value in any of loops. 

    Program for triangular patterns of alphabets
    https://www.geeksforgeeks.org/program-for-triangular-patterns-of-alphabets/