WAP to print the following output using for loops (C++)

1
22
333
4444
55555
…………
#include <iostream.h>
int main()
{int n;
cout<<"Enter the no. of lines : ";
cin>>n;
for (int i=1; i<=n; i++)
    {for (int j=1; j<=i; j++)
        {cout<<i;
        }
    cout<<"\n";
    }
return 0;
}
problem 3.3 from E Balagurusamy’s Object Oriented Programming C++ (p 75)