Star printing program in c, Pattern 1

Pattern 1:



Discussion: 
This code will print 1 star in first row and from next row it increase
by 1 to n.

Code:

#include <stdio.h>

int main()
{
    int i,j;
    for(j=0;j<8;j++)
    {
        for(i=0;i<=j;i++)
            {
               printf("*");

            }
            printf("\n");
    }
    return 0;
}
 

Return to:

How to print stars pattern (" * ") in C ?                                                                        Next pattern

 

0/Post a Comment/Comments