Inverted pyramid with numbers pattern in c.
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("enter the rows =");
scanf("%d",&n);
for(int i=1; i<=n; i++)
{
for(int j=1; j<i; j++)
{
printf(" ");
}
for(int j=n; j>=i; j--)
{
printf("%d ",i);
}
printf("\n");
}
getch();
}
■》 Output->
enter the rows =5
1 1 1 1 1
2 2 2 2
3 3 3
4 4
5
Comments
Post a Comment