Program to print inverted half pyramid using number
#include<iostream.h>
#include<conio.h>
int main()
{
int rows;
cout<<"Enter number of rows :";
cin>>rows;
for(int i=rows; i>=1; --i)
{
for(int j=1; j<=i; ++j)
{
cout<<i;
}
cout<<endl;
}
getch();
}
Output :
Enter number of rows: 5
5555
444
33
2
No comments:
Post a Comment