C Program to print Right angled Triangle in a pyramid star pattern Type 2
Program
#include<stdio.h>
void main()
{
int i, j, k, n;
printf("Enter number of rows of stars to print\n");
scanf("%d", &n);
for(i = n; i >= 1; i--)
{
for(j = 1; j < i; j++)
{
printf(" ");
}
for(k = n; k >= i; k--)
{
printf("*");
}
printf("\n");
}
}
Output
Enter number of rows of stars to print
5
*
**
***
****
*****