Star printing program in c, Pattern 4

Pattern 4:



Discussion:

It print stars like reverse pyramid. Reverse form of pattern 3.

Code:


#include <stdio.h>

int main()
{
    int n, i, j, k, l, m;
    l=0;
    m=5;
    for(i=0;i<5;i++)
    {
        for(j=0;j<l;j++)
        {
            printf(" ");
        }
        for(k=0;k<2*m-1;k++)
        {
            printf("*");

        }
        l=l+1;
        m=m-1;
        printf("\n");
    }
    return 0;
}

Return to:

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

Previous pattern                                                                                                                Next pattern


0/Post a Comment/Comments