#include<stdio.h>
int main ()
{
int n,t,i,j,k;
printf("Enter a number");
scanf("%d",&n);
n=n-1;
k=n;
for (i=0;i<=n;i++)
{ j=k;
k=k-1;
while(j!=0)
{printf(" ");
j=j-1;}
for(t=0;t<=i;t++)
{printf("* ");
}
printf("\n");
}
}
int main ()
{
int n,t,i,j,k;
printf("Enter a number");
scanf("%d",&n);
n=n-1;
k=n;
for (i=0;i<=n;i++)
{ j=k;
k=k-1;
while(j!=0)
{printf(" ");
j=j-1;}
for(t=0;t<=i;t++)
{printf("* ");
}
printf("\n");
}
}
Output
Enter a number
5
*
* *
* * *
* * * *
* * * * *