84.4k views
10 votes
Write a C++ program to get the following output. 1 12 123 1234 12345​

1 Answer

8 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 Daliz
by
5.1k points