Mirrored Right Triangle Pattern In C

Simple C program to print the mirrored right triangle pattern in C.

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k;
clrscr();
for(i=0;i<=4;i++)
{
for(k=0;k<=4-i;k++)   // for  gap –>the gap is in the reverse order.
{
printf(” “);  // empty space
}
for(j=0;j<=i;j++)
{
printf(“*”);
}
printf(“\n”);
}
getch();
}

Output:

pyramid in c

 

Leave a Reply