.

LOOPING IN C LANGUAGE

when we want to executed a statement More then once based on some particular Condition, then this concept known as looping. In C language the following looping statement are there:-    1. While loop.       2. Do while loop          3. For loop.            4. Nested loop.

      1. WHILE LOOP 

the general syntax of while loop is as follows:-
          while
{       ;
       /;  }
The execution of the above while loop is as follows:-  Firstly it will check the given condition, if the given condition is true then the statements are executed and these statements are executed till the given Condition is true when the given condition is false then loop is automatically terminated.

2.

DO WHILE LOOP 



 the general syntax of do while loop is as follows:-
    do
{         ; }
    while;
The execution of the above code is as follows:- Firstly the statement are executed are executed and then if will check the given condition and the statement are executed till the given condition is and when the Given condition is false then loop is automatically terminated.

Difference between while and do while loop -the difference in while and do while loop is that in while loop, firstly condition is checked and if the condition is true then statement are executed and the condition is false the loop is Automatically terminated, but in do while loop firstly the the statement are executed and then it will check the given condition i.e. the do while loop is executed at least once.




Looping in C

      3.FOR LOOP 

the general syntax of for loop is as follows:-
for (initialization; condition section; increment /decrement section)
{
    ;   }
In the initialization section, we have to initialize the variables, in the condition check section we have to check the condition and in the increment/decrement section we have to either increment the value or Decrement the value based on our requirement.

      4.NESTED LOOP

nested loop means loop within a loop in this nested loop, the first lop is outer loop and the another lop is inner loop.
The general syntax of for loop is as follows:-
 For (i.s; c.c.s; i.or.d.s) //outer loop
{   For (i.s; c.c.s; i.or.d.s) //inner loop
{   ;  }  }
The execution of nested loop is as follows:-
Firstly the outer loop is executed and according to outer loop, the inner loops are executed and according to inner loop the statement are executed. When the inner loop is terminated then the control is automatically goes to outer loop and when The outer loop is terminated then the complete loop is terminated.

4. SWITCH CASE 

when we want the check the various cases based on a given condition then we have to use the concept of
                                       switch case.
The general syntax of switch case is as follows:-
Switch (expression)
{
Case1:    ;
                 Break;
Case2:    ;
                 Break;
Case3:    ;
                 Break;
------------------------
------------------------
------------------------
------------------------
Case n:    ;
                 Break;
Default:     ;
}
The execution of the above switch case is as follows:-    



If the expression satisfies the case 1 then the statements of case 1 is executed and the switch is automatically terminated, if the expiration satisfied the case 2 then the statements of case 2 is automatically executed and then the switch is automatically terminated, this process is undergone for (n) case. and If the expression does not satisfy any cases then the pointer is automatically Goes to default and the statements of default is automatically executed.

Keywords: syntax of while loop, how to use for loop in c,syntax of switch-case construct, nested looping in c, advantages of looping in c.