number pattern

write a c program to create following number pattern

1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Program:

#include"stdio.h"

void main()

{
    int i, j, n=1;
    for(i=1; i<=5; i++)
    {
        for(j=5; j>=i; j--)
        {
            printf("%d ", n);
            n++;
          
        }
    printf("\n");
    n = 1;

    }
   
}

Output:


 

Comments

Popular Posts