Home / Questions / How many times will the following loop execute? What value will be returned? int x = 2, y = 50; do{ ++x; y -= x++; }while(x
Explanatory Question

How many times will the following loop execute? What value will be returned?

int x = 2, y = 50;
do{
    ++x;
    y -= x++;
}while(x <= 10);
return y;

👁 112 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

The loop will run 5 times and the value returned is 15.