+ 1
How to make c++ program by using loop to print:
1 12 123 1234 12345
1 Answer
+ 1
#include <iostream>
using namespace std;
int main() {
int i,j;
for(i=0;i<5;i++)
{
for(j=5;j>i;j--)
{
cout << " ";
}
for(j=1;j<=i+1;j++)
{
cout << j;
}
cout << "\n";
}
return 0;
}