Trying something

The program prints numbers between 1 and 16 using a for loop can you help convert it to a do...... while and while loop.
#include<iostream>
{ int x;
for(x=1;x<=16;x++)
}
{
cout<<x;
}
else{}
return 0;
}
If you want the program all coded, you will get nowhere. http://www.cplusplus.com/doc/tutorial/control/

But if that's what you want to:
1
2
3
4
5
6
7
8
9
10
#include <iostream>
int main()
{
    int x = 1;
    do
    {
        std::cout << x;
    } while ( x <= 16 );
    return 0;
}


BTW, else after for have no sense.
Topic archived. No new replies allowed.