I was wondering if anyone could help me code a triangle that generates the following output:
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
I was wondering if anyone could help me code a triangle that generates the following output:
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
try
int max; //Max is the highest number you wish to goto
for (int i =1; i <= max; i++)
{
for(int j = 0; j <= i; j++)
{
cout<<j<<" ";
}
cout<<endl;
}