Please briefly explain me about while loop with some coding as a example and with its flow chart.
define while loop.
600
21-Jan-2020
Nishi Tiwari
21-Jan-2020While loop will execute the block of statement until the specified condition evaluates true.
For loop is used in case, when we know how many times the block of statement will execute but in case if we don’t know the exact number of times the body will execute then while loop is best suited in that case.
Using keyword, while we create the body of while loop.
Syntax
Here, if condition evaluates true then only the block of statement will execute and condition will be checked again to execute the statement with in the while loop.
If condition evaluates false then while loop stops the execution of statement and programs comes out of loop.
Example