1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
.
.
.
n#include<stdio.h>
#include<conio.h>
void main()
{
int r,c,n,sp;
clrscr( );
printf("Enter the no. of rows u want to print:");
scanf("%d", &n);
for(r=1; r<=n; r++)
{
for(sp=n; sp>=r; sp--)
printf(" "); // give one space in between quotations.
for(c=1; c<=r; c++)
printf("%2d", c);
printf("\n");
}
getch();
}
No comments:
Post a Comment