Control LOOP
1.Entry
Control loop: - In which condition is checked at the entry point for the
execution of the loop. For and while loop comes in this category
2.Exit
control loop: - In which condition is checked at the last point for the
execution of the loop. Do while loop is exit control loop. It execute at least
once.
1. While Loop: - In while loop we first write the initial value and then we checks the condition
if the condition is true it enters the loop otherwise it comes out. In true condition it executes all the statement inside the curly braces. And then again checks. The condition this process repeats till the condition is true.
Syntax
Initialization;
While (Condition checking)
{ //body of the loop
Increment/decrement;
}
Comments
Post a Comment