Write the following do-while statement with a while construct, and maybe some extra code.

```
x = 10;
do
{
cout << x << endl;
x = x - 3;
} while ( x > 0 );
```

A simple minded change from do while to while and insertion of the loop body gives this:
```
x = 10;
cout << x << endl;
x = x - 3;
while ( x > 0 )
{
cout << x << endl;
x = x - 3;
}
```

A look at the code suggests that the following is somehow 'smarter'
```
x = 10;
while ( x > 0 )
{
cout << x << endl;
x = x - 3;
}
```

Computer Science & Information Technology

You might also like to view...

The main page for Facebook members is the ________ page

Fill in the blank(s) with correct word

Computer Science & Information Technology

A ________ maintains a database of hostnames and their corresponding IP addresses.

a. file. b. database. c. DNS server. d. None of the above.

Computer Science & Information Technology