1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Program
code
#include
<stdio.h>
#include
<conio.h>
void
main()
{
int
inner, outer, rows=1;
clrscr();
printf(“How
many rows do you want to see? \n”);
scanf(“%d”,
&rows);
printf(“The
pattern is displayed below.\n”);
for
(outer=rows;outer>=1;outer--)
{
for
(inner=1;inner<=outer;inner++)
printf(“%d\t”,inner);
printf(“\n\n”);
}
getch();
}
Example
of output
How
many rows do you want to see?
7
The
pattern is displayed below.
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
No comments:
Post a Comment
Please write here, your opinion about this C program