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 Share on WhatsApp
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo