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...

Which of the following methods would be used to disable the PRESET (_P_R_E_) and CLEAR (_C_L_R_) inputs to a clocked flip-flop in a circuit application where they are NOT used?

Computer Science & Information Technology

Live ________ displays the table with the selected style

Fill in the blank(s) with correct word

Computer Science & Information Technology

The adjacency list uses a two-dimensional ____ array to store the edges.

A. ragged B. sorted C. dynamic D. hash-based

Computer Science & Information Technology

Your app must first pass a set of minimum standards before you can ____________ it to Google Play.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology