For loop application

Jan 29, 2010 at 9:44am
&
& &
& &
& &
& & & & & & & & & & & & &


this is not an assignment to me . i spent my head on this for a long time cant get into the bottom of it.

If you can please post it.
Jan 29, 2010 at 10:37am
What?
http://www.cplusplus.com/articles/how_to_ask/
Be precise and informative about your problem
Jan 29, 2010 at 10:48am
you are bad at presenting your favour......
Jan 29, 2010 at 10:55am
is this what you're trying to do?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
using namespace std;

int main() {
    int size;
    cout << "Enter the length: ";
    cin >> size;

    for(int x=0; x<size; x++) {
        for(int i=1; i<size-x; i++)
            cout << ' ';

        for(int y=0; y<x*2+1; y++)
            cout << '&';

        cout << endl;
    }
    return 0;
}
Topic archived. No new replies allowed.