Difference between for loop and while loop and do while loop?

Answer:
for loop it consists of 3 parts 1. initialization 2. condition 3. incrementation like
for(i=1;i<=10;i++).This loop executes 10 times.

While loop: This is an entry check loop. First it checks for the condition and if the condition is true then only loop will be executed and this continues till the condition becomes false.
ex: i=0;
while(i<10)
{i++;
} This loop executes 10 times.

Do loop: This is an exit check loop. This executes the loop at least once even when the condition is false.
ex: 1=0;
do
{
i++;
}while(i<10);
First answer by ID1975892309. Last edit by ID1975892309. Question popularity: 2 [recommend question].