QUESTION:- print a pattern as shown below
1
1 2
1 2 3
1 2 3 4
#include <stdio.h>
#include <conio.h>
int main()
{
int i, j, k, no;
printf("Enetr a value: ");
scanf("%d", &no);
// rows
for(i = 1; i<=no; i++)
{
// space
for(j = no; j>=i; j--)
{
printf(" ");
}
// display
for(k = 1; k<= i; k++)
{
printf("%d ", k);
}
printf("\n");
}
return 0;
getch();
}
OUTPUT
Note:- you can make changes to all the patterns according to your wants and need.
Enter a value: 5
1
1 2
1 2 3
1 2 3 4
0 Comments