Differentiate between for loop and while loop?

 

Answer:

For loop

While loop

The for statement is used to iterate over a range of values or a sequence .

The while statement executes a block of code repeatedly as long as the control condition of the loop is true. 

It is called a definite loop.

It is called an indefinite loop.

Flowchart:

Differentiate between for loop and while loop - Flow of Control - Short Answer Type Questions (2/3 Marks each)

Flowchart:

part 2 - Question 2 - Short Answer Type Questions (2/3 Marks each) - Chapter 6 Class 11 - Flow of Control - Computer Science - Class 11

Remove Ads
Teachoo · Class 11 Explore Class 11
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh is an IIT Kanpur graduate and has been teaching for 16+ years. At Teachoo, he breaks down Maths, Science and Computer Science into simple steps so students understand concepts deeply and score with confidence.

Many students prefer Teachoo Black for a smooth, ad-free learning experience.