+ 1

do while loop

loop

24th Dec 2017, 4:45 AM
Laxman Kumawat
Laxman Kumawat - avatar
5 Answers
+ 18
Please elaborate your question... where are you facing difficulties in loops.. https://www.sololearn.com/discuss/333866/?ref=app
24th Dec 2017, 4:51 AM
Frost
Frost - avatar
+ 4
int a=2; do{ cout<<a; a++; } while (a<=6);
24th Dec 2017, 5:25 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 4
do while loop first runs the statement and then check the condition i.e even if condition is false it will execute once(which makes it different from while loop) --------------------------------- syntax in c: do { statement(s); } while( condition ); -------------------------------------------------------- syntax in java: int x = 1; do { System.out.println(x); x++; } while(x < 5); /* output 1 2 3 4 */
24th Dec 2017, 7:42 AM
prachal goyal
prachal goyal - avatar
+ 2
do while loop will at least run the statement once no matter even it is false.
24th Dec 2017, 9:38 AM
Robin
Robin - avatar
- 1
Rearrange the blocks to form a correct do while loop $i++ do { $i = 0; } while ($i < 10):
13th Sep 2020, 3:17 AM
al younes
al younes - avatar