Computer Science, asked by mdey98343, 1 day ago

what is defferent between while and do- while loop?​

Attachments:

Answers

Answered by ry6635440
2

while

1. Condition is checked first then statement(s) is executed.

2. It might occur statement(s) is executed zero times, If condition is false.

3. No semicolon at the end of while. while(condition)

4. If there is a single statement, brackets are not required.

5. Variable in condition is initialized before the execution of loop.

6. while loop is entry controlled loop.

do-while

1. Statement(s) is executed atleast once, thereafter condition is checked.

2. At least once the statement(s) is executed.

3. Semicolon at the end of while. while(condition);

4. Brackets are always required.

5. variable may be initialized before or within the loop.

6. do-while loop is exit controlled loop.

Similar questions