- 1
What are the values of the variables s and x after running this piece of code?
int s = 12; int x = 87; do { s = x; x -= 40; }while (x < 20);
2 Réponses
+ 4
first loop:
s = 87, x = 47.
Second loop cannot be executed because x is greather than 20.
do-while loop executes at least one loop, what cannot be done with while loop.
0
try it by yourself, by running it in a code playground ;P