Click the Follow Button

C; Print pattern 5 to 1 star.

 Pattern:

*****

****

***

**

*


Code;

#include<stdio.h>

int main ()
{
    int n;
    printf("enter the number: ");
    scanf("%d", &n);
    for(int i = 1; i <= n; i++ )
    {
        for (int j = n; j >= i; j--)
        {
            printf("*");
        }
        printf("\n");
       
    }

    return 0;
}


Output:

enter the number: 5

*****

****

***

**

*

Comments

Popular Posts

TIC - TAC - TOE

Prime and not prime number

do_while loop is to do something again and again