1
12
123
1234
12345
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int r, p, k,g=0,h=1;
clrscr();
printf("\n enter the no of row");
scanf("%d", &r);
for ( k = r ; k >= 1 ; k-- )
{
for ( p = --r; p >0; p--)
printf(" ");
for ( p = 1;p <=h ; p++)
printf("%d", p);
h++;
printf("\n");
}
getch();
}
Output:
12
123
1234
12345
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int r, p, k,g=0,h=1;
clrscr();
printf("\n enter the no of row");
scanf("%d", &r);
for ( k = r ; k >= 1 ; k-- )
{
for ( p = --r; p >0; p--)
printf(" ");
for ( p = 1;p <=h ; p++)
printf("%d", p);
h++;
printf("\n");
}
getch();
}
Output:
No comments:
Post a Comment