For loops

May 14, 2013 at 8:19am
hi guys, i would like to print something like
3 2 1
2 1
1
or
1
2 1 2
3 2 1 2 3
4 3 2 1 2 3 4
using a for loop but my codes are coming all wrong please help me out??
May 14, 2013 at 9:33am
Mess around with it.

1
2
3
4
5
6
7
8
#include <iostream>
int main()
{
    int a(4);
    for (int i(a); i >= -a; --i)
        std::cout << i << " ";
    return 0;
}
May 22, 2013 at 1:53pm
thanks very much dude!!!!!!
Topic archived. No new replies allowed.