Do-while loop is also a type of repetition structure used to repeat statement(s) for certain number of times. The major difference between while and do while loop is that in do while loop the loop termination condition is checked after the execution of loop body whereas in while loop the loop termination condition is checked before the execution of loop body. Do-while loop at least runs one time no matter if the loop termination condition is true or false. Following simple program explains how to use do-while repetition structure (also called as do-while loop) to print numbers from 1-10.
|
ArchivesCategories |