✏️ 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
🟡 Medium
💡

Answer with Explanation

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