Flowchart for the IF statement and for the WHILE loop
This is a very basic interview question but many get stuck.
Question: Draw the FLOWCHART for the IF statement , and for the WHILE loop.
Answer: The flowcharts are attached.
The if statement is on the left of the picture. So, it checks a condition once and decides whether to do the action of not. If the condition is true, it executes the action and then ends. If the condition is false, it skips the action and goes straight to the end. This means the action either happens once or not at all.
The while loop is on the right of the image. It checks a condition. If True, then it does the action. If condition was true then It loops back to check the condition again instead of ending. This creates a cycle where the action keeps getting performed repeatedly as long as the condition remains true. Only when the condition finally becomes false does the program exit the loop.
14
6 comments
Spyros Giannelos
7
Flowchart for the IF statement and for the WHILE loop
powered by
Energy Data Scientist
skool.com/software-school-for-energy-7177
This community provides the Energy Data Scientist training program to help you build and maintain expertise as an Energy Data Scientist.
Build your own community
Bring people together around your passion and get paid.
Powered by