Computer Science, asked by vaishaliranpura, 10 months ago

Q-2 please give ans with explaination.

Attachments:

Answers

Answered by varadhabala29
1

Answer:

The answer is 11.

Explanation:

A do while loop works under the condition that the body of the loop gets executed once and only then, it checks the condition. Thus, first the body of the loop gets executed which turns the value of a to 6. Then the condition a<=b is checked, i.e., 6<=10 is true. Thus the body gets executed again. Now the value of a becomes 7. Again the condition a<=b is checked, i.e., 7<=10 is true. Thus the body gets executed again. Now the value of a becomes 8. Then the condition a<=b is checked, i.e., 8<=10 is true. Thus the body gets executed again. Now the value of a becomes 9. Again the condition a<=b is checked, i.e., 9<=10 is true. Thus the body gets executed again. Now the value of a becomes 10. Then the condition a<=b is checked, i.e., 10<=10 is true. Thus the body gets executed again. Now the value of a becomes 11. Then the condition a<=b is checked, i.e., 11<=10 is false. Thus the statement after loop is executed which prints 11 on screen.

Similar questions