write a c program to generate following output.
1
2 3
4 5 6
7 8 9 10
#include <stdio.h>
#include <conio.h>
void main()
{
int i, j, a = 1, k = 1;
clrscr();
for (i = 1; k <= 4; i++)
{
for (j = 1; j <= 1; j++)
{
printf(" ");
}
for (k = 1; k <= i; k++)
{
printf(" %d ", a);
a++;
}
printf("\n");
}
getch();
}
Thank you for visiting seeya again
No comments:
Post a Comment