Sunday, November 10, 2013

Printing numbers in the below given format

/*
Program to Print Numbers in the below format
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
*/


#include<stdio.h>
void main()
{
int lines=0,i, num=1,col=0,count=0;
while(lines<5)
{
count++;
col=0;
for(i=col;i<count;i++)
{
printf("%d \t",num);
num++; col++;
}
printf("\n");
lines++;
}
}