Program using Nested For Loops

How to write a program using nested for loop to display the following output:

0
* *
0 1 2
* * * *
0 1 2 3 4
* * * *
* * *
* *
*
are those asteriks supposed to be spaces, actual asteriks, or are we to assume we recognize the pattern that it ascends to 01234 then descends back down to 0 like a sideways pyramid?
we dont plan on doing your homework for you, give it a shot and come back when you're ready to work.
this is what i have, but understand anything

#include <iostream>

using namespace std;

int main()
{

for(int a = 0; a <= 4; a++)
{
for(int b = 0; b <= a; b++)
{
if(a % 2 == 0)
{
cout << b << " ";
}
else

cout << "* ";
}
cout << endl;

}

for(int c = 0; c <= 4; c++)
{
for(int d = 4; d > c; d--)
{
cout <<"* ";
}
cout << endl;
}

system("pause");
return(0);
}
Topic archived. No new replies allowed.