Star printing program in c, Pattern 6

Pattern 6:



Discussion:

Reverse form of pattern 2. Using scanf() function to take user input.



Code:

#include <stdio.h>

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

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

         printf("\n");
    }

    return 0;
}

Return to:

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

Previous pattern                                                                                                        Next pattern

0/Post a Comment/Comments