C Program to Print Mirror of Right Angled Triangle


Pyramid Program in C Programming - Mirror Image of Right Angled Triangle

Print the Following Pattern of Pyramid

Program :

Explanation of C Program :

  1. space_count‘ variable is used as subscript variable used in for loop.
  2. no_of_spaces‘ variable is used to keep track of no_of_spaces to be printed.
  3. Note that Space width mentioned in printf of second inner loop is “%2c” , that’s why we have printed 2 spaces inside first inner loop.

Why 3 for loops are used ?

  • Outer For Loop - Specify No of Rows to be Printed
  • First Inner For Loop - Specify How many Spaces is to be printed in a particular row.
  • Second Inner For Loop - Specify no of ‘*’ to be printed on the same line.