Monday, December 16, 2013

FOLLOWING FORMAT

/* WAP TO PRINT THE FOLLOWING FORMAT  :-


   1
         2   3
4   5   6
     7   8   9   10  



#include<stdio.h>
#include<conio.h>
 void main()
 {
int i,j,m=1;
int space;

clrscr();

space=3;
for(i=1;i<=4;i++)
{
for(j=1;j<=space;j++)
{
printf("  ");                     // 2-SPACES.
}
for(j=1;j<=i;j++)
{
printf("%d   ",m);
m++;
}
printf("\n");
space=space-1;
}
getch();
 }

No comments:

Post a Comment