Coupon Accepted Successfully!


The do-while Statement With while Loop

The format of do-while with multiple while statements loop is as shown in Figure.

Syntax of do-while with multiple while statement

6.10 Write a program to add numbers from 0 to 5 using while statement in do-while loop.

Explanation: Initially the value of x and sum are 0. Value of x is incremented in and added with the sum in each iteration. With do-while loop the value of x is incremented and when it is greater than 5 the outer while loop is executed.

Test Your Skills Now!
Take a Quiz now
Reviewer Name