Using a nested for loop, create a program that will display the following:
55555
4444
333
22
1
Source code
#include <iostream>
using namespace std;
int main()
{
int n=5;
for(int i=5;i>=1;i--){
for(int j=1;j<=i;j++){
cout<<i;
}
cout<<endl;
}
return 0;
}
Output
Comments
Leave a comment