Help!!

How can I make this display using only 2 for loops:

**
****
******
********

1
2
3
4
5
6
for(i=1;i<=4;i++){
    for(j=1;j>=8;j++){
        cout<<"*";
    }
    cout<<endl;
}
1
2
3
4
5
6
7
8
9
int i,j,x;
x=2;
for(i=0;i<4;i++){
    for(j=0;j<x;j++){
        cout<<"*";
    }
    cout<<endl;
    x+=2;
}
thank you so much jikax
closed account (D80DSL3A)
Try doing it without the variable x. That variable isn't needed.

@ Jikax. Simply handing out solutions to homework problems is generally frowned upon here.
sorry... will just explain next time.
You might want to play with while too!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int main()
{
    for(int i=1;i<=100;i++)
    {
        int n = i;
        while(n!=0)
        {
            cout << "*";
            n--;
        }
        cout << endl;
    }
    getchar();
    return 0;
}
Topic archived. No new replies allowed.