411,314 views
25 votes
25 votes
Write a C++ program to get the following output. 1 12 123 1234 12345​

User Chris Truman
by
2.5k points

1 Answer

13 votes
13 votes

#include"stdafx.h"

#include<iostream>

usingnamespace std;

int main()

{

for(int i=1; i<=5; i++)

{

for(int j=1; j<=i; j++)

{

cout<<j ;

}

cout<<endl;

}

system("pause");

return 0;

}

User Jon Adams
by
3.1k points