Saturday, 11 June 2016

Number pattern 1

Firstly we will take a for loop(outer) for no of rows.

Print numbers
For every ith row , print i numbers.Also remember numbers are printed in descending order.
#include<stdio.h>

int main()
{
    int i,j;

    for(i=1;i<=4;i++)
    {
        for(j=i;j>=1;j--)
            printf("%d ",j);

        printf("\n");
    }

    return 0;
}

No comments:

Post a Comment