Outputting with spaces vs line by line

I have written code that counts down from 10 to 1 and displays like this using a loop:

10
9
8
7
6
5
4
3
2
1

How do I get it to output like this:

10 9 8 7 6 5 4 3 2 1

Thanks

1
2
3
4
5
6
7
8
9
10
11
#include <iostream>

int main()
{
    const int MAX = 10 ;

    for( int n = MAX ; n > 0 ; --n )
        std::cout << n << ' ' ; // print 'n' followed by a space

    std::cout << '\n' ; // and print a new line after the loop ends
}
Topic archived. No new replies allowed.