Star printing program in c, Pattern 5

Pattern 5:



Discussion: 

Reverse form of pattern pattern 1. It's take user input to print stars.

Star printing program in C Code:

#include <stdio.h>

int main()
{
    int n, i, k, j;
    printf("how many row u wnt : ");
    scanf("%d", &n);
    for(i=1;i<=n;i++)
    {
        for(k=0;k<=n-i;k++)
        {
             printf(" ");
        }

       for(j=n;j>=k;j--)
       {
           printf("*");
       }

         printf("\n");
    }

    return 0;
}

Return to:

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

Previous pattern                                                                                                             Next pattern


0/Post a Comment/Comments