//Program to print the reverse pyramid of no.
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7
1 2 3 4 5
1 2 3
1
#include<stdio.h>
#include<conio.h>
main()
{
int x,y,i,g;
y=9;
for(x=4;x>=0;x--)
{
for(i=4;i>x;i--)
{printf(" ");
}g=1;
for(i=0;i<y;i++)
{printf("%d",g);g++;
}
y=y-2;
printf("\n");
}
getch();
}
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7
1 2 3 4 5
1 2 3
1
#include<stdio.h>
#include<conio.h>
main()
{
int x,y,i,g;
y=9;
for(x=4;x>=0;x--)
{
for(i=4;i>x;i--)
{printf(" ");
}g=1;
for(i=0;i<y;i++)
{printf("%d",g);g++;
}
y=y-2;
printf("\n");
}
getch();
}
No comments:
Post a Comment