Do-While Loops Logical Error Help

Good day to everyone.
I'm a newbie at C++ programming and I have a concern regarding the do-while loop code below. The output is:

10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,

I need to remove the comma sign (,) after 0. Can someone lend a hand with this?

#include <iostream>

using namespace std;

int main()
{
int ctr = 10;
do {
cout << ctr <<", ";
ctr--;
}while (ctr>=0);

return 0;
}
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

using namespace std;

int main()
{
    int ctr = 10;
    do
    {
        cout << ctr << ", ";
        ctr--;
    } while (ctr > 0);
    cout << ctr;

    return 0;
}
Thanks, men I appreciate it.
Topic archived. No new replies allowed.