while loop
1.while Loop:
While statement is one of the frequently used loop statement in programming. The while statement tells the compiler to repeat the series of statement as long as certain condition is true. As soon as the condition becomes false computer stop repeating and goes to the next statement.
In this loop, the condition is given at the top. While statement test the value of expression before processing the body of while. Then computer execute the body of while. The body of while may have one statement or more than one statement. If there is a single statement no need of bracket '{' '}'. If there are more than one statement then brackets are compulsory.
Flowchart:
Ex:
Display 1,2,3,...............100
Comments
Post a Comment