QUESTION:- write a program to printing following pattern in c.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
#include <stdio.h>
#include <conio.h>
int main()
{
int i, j, no;
printf("enter a value: ");
scanf("%d", &no);
for (i = 1; i <= no; i++)
{
for (j = 1; j <= i; j++)
{
printf("%d ", j);
}
printf("\n");
}
return 0;
getch();
}
enter a value: 5
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Follow our page for regular updates.
0 Comments