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;

Long Answer
Views 103

Answer:

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

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.