3. Loops #

Created Wednesday 16 October 2019

When we have to do a thing for some known number of times or until an event occurs, we use the concept of loop. Basically, we just take the arrow to a previously executed component.

e.g print all numbers from 1 to N. Assume N>=1. How will a human do this, he’ll start counting from 1 and then writing all numbers, while checking if currentNum<=N. This is exactly what a computer does.

In terms of a flowchart, this happens:

P2: Print all the even number between 1 and N (both inclusive)