Loop is very important in any Programing language. Looping is used when we execute the statement in multi time .The part which is executed again and again in this manner is known as the body of the loop. During the execution of the loop whenever the control falls to the end of the body of loop .it again jumps to the starting point of the body of the loop This is continues as long as some predefined condition is satisfied .They are three type
1.While Loop
2.Do While Loop
3 For Loop
while Loop This is used to execute the block of statements till the value of the conditional expression is true .While loop if is true then the body of the loop is executed .After execution of the body (contain statements and increment /decrement par) the test condition is again tested and if it is true then the body is executed again.
Syntax:
while(expression)
{
statement;
increment/decrement ;
}
Program
Watch video tutorial