This is what i've made so far.
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int b=1;
for (int i=1; i<=5; i++)
{
for (int k=1; k<=i; k++)
{
cout<<b;
b++;
}
cout<<endl;
}
getch();
return 0;
}
The output is as below
1
23
456
78910
1112131415
The correct one should be:
1
12
123
12
1
Any help would be greatly appreciated.