C Program to Generate Equilateral Triangle Shape Pattern
Generating equilateral triangle shape pattern using stars in C programming language.
Equilateral Triangle Shape C Program
#include<stdio.h>
int main()
{
int i, n, j;
printf("Enter number of lines: ");
scanf("%d", &n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i;j++)
{
printf(" ");
}
for(j=1;j<=2*i-1;j++)
{
j==1||j==2*i-1||i==n?printf("*"):printf(" ");
}
printf("\n");
}
return 0;
}
Output of Above Program
Enter number of lines: 10 * * * * * * * * * * * * * * * * * *******************