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