Click the Follow Button

C; Print pattern 54321, 4321, 321, 21, 1.

 Pattern:

54321

4321

321

21

1

Code:


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

       
    }

    return 0;
}


Output;

enter the number: 5

54321

4321

321

21

1

Comments

Popular Posts

TIC - TAC - TOE

Prime and not prime number

do_while loop is to do something again and again