Wednesday, 8 April 2015

C Program to print the following pattern.

1    2    3    4
5    6    7
8    9
10

: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

#include<stdio.h>
#include<conio.h>
main()
{
                int i=1,j,k;
                clrscr();
                for(j=3;j>=0;j--)
                {
                                for(k=0;k<=j;k++)
                                {
                                                printf("%d\t",i+k);
                                }
                                i=i+j+1;
                                printf("\n");
                }
}

No comments:

Post a Comment