Star printing program in c, Pattern 2

Pattern 2:


Discussion:

This is the reverse form of pattern 1.The following code print stars so that, the first
row prints as length user enter. The number of stars decrease by one in every new row.
This code ask user to enter choice using scanf().

code:

#include <stdio.h>
int main()
{
    int i,j,t;
    printf("How many row you want ");
    scanf("%d",&t);
    for(j=0;j<t;j++)
        {
    for(i=t-2;i>=j;i--)
    {
        printf("*");

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

Return to:

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

Previous pattern                                                                                                             Next pattern

Star printing program in c coding. Print star in c and java programming.This is the reverse form of pattern 1.The following code print stars so that, the first row prints as length user enter. The number of stars decrease by one in every new row.Star printing program in c.