How many types of loop we have? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How many types of loop we have?

Three types of loop for loop do loop while loop

5th Dec 2017, 1:10 PM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
14 Answers
0
4 types of loops 1.for 2.while 3.do while 4.enhanced for loop
6th Dec 2017, 6:50 PM
Raktim Mukherjee
Raktim Mukherjee - avatar
+ 18
No. Do..while loop
5th Dec 2017, 1:11 PM
Nithiwat
Nithiwat - avatar
+ 4
Three types
5th Dec 2017, 1:10 PM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
+ 4
10 times forgetting the error of initializing i and instead increment j
9th Dec 2017, 4:15 PM
Mohamed Gadaphy Nkwenkwat
Mohamed Gadaphy Nkwenkwat - avatar
+ 3
Do while are those which are tested in bottom
5th Dec 2017, 4:30 PM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
+ 2
for (i=0;i <=10;i++) how many time loop will excute
7th Dec 2017, 5:01 AM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
+ 2
10 times
7th Dec 2017, 10:43 AM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
+ 2
a)three types of loops exist in C ; 1) for loop 2) while loop 3) do while loop b) Their syntax are; int j;// let declare the looping variable // for loop for(j=0;j<5;j++) { // the looping instructions instructions 1; . . instructions n; } //while loop j=0; /* with while loop, always initialise before starting the looping*/ while(j<5) { block of instructions j++;/*don't forget to specify how the looping variable should displace itself, which is either incremental or decremental } //do while loop do { j=0; block of instructions j++; } c) which loop should I used as there are three types of loops? what is the difference between while and do while? if you need to know the answer to these questions on part c, tap reply and I will continue.
7th Dec 2017, 5:16 PM
Mohamed Gadaphy Nkwenkwat
Mohamed Gadaphy Nkwenkwat - avatar
+ 2
in mr. mohamed's answer after last curly bracket in do while loop there should be written as while(condition statement); like while(j<7);
8th Dec 2017, 6:58 AM
manas palai
+ 2
for (i=1;i <=10;j++) how many type loop will excute
9th Dec 2017, 2:57 AM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
+ 1
11times the will be excuted @puneet
7th Dec 2017, 9:00 AM
Venkatesh R B
Venkatesh R B - avatar
+ 1
for loop while loop do while loop
7th Dec 2017, 4:36 PM
manas palai
+ 1
loop will execute for 11 times @puneet,since loop starts from 0 and goes till 10 means 11 if the loop structure had been for(i=0;i<10;i++) the. it would have executed 10 times as the loop fails when i=10
8th Dec 2017, 5:54 AM
Raktim Mukherjee
Raktim Mukherjee - avatar
+ 1
ooh I thought that I put it already this is the syntax // do while loop do { instructions; initialize or increment j; } while(j<7);. // the semi colon at the end is very important
8th Dec 2017, 7:26 PM
Mohamed Gadaphy Nkwenkwat
Mohamed Gadaphy Nkwenkwat - avatar