C program to
print standing triangle pattern. For n = 3, generate pattern as shown below:
*
* *
* * *
* *
*
#include<stdio.h>
int main()
{
int i, j, N=5;
for(i=0; i<N; i++)
{
for(j=0; j<=i; j++)
printf("* ");
printf("\n");
}
for(i=0; i<N; i++)
{
for(j=N-1; j>i; j--)
printf("* ");
printf("\n");
}
return 0;
}
|
Output of the
Program:
*
* *
* * *
* *
*
Thanks .. Here is a set of C star pattern programs for triangle, pyramids, number pattern etc.
ReplyDelete