CONDITIONAL STATEMENTS

Conditional statement is used to cheek any particular condition according to this user’s requirement.
The following are the conditional statements which are used in C language.

1.    If else - the general syntax of  if  else is given as following.
   if
{
;
}
else
{
;
}
The execution of the above if else statement is as follows:-
If the result of the above condition is true then the statement of the if condition is executed and if the result of the above condition is false then control is automatically goes to the else part and the statements of the else is executed.




                                          
2.    If else if else - the general syntax of else if else if is as follows.

          if
{                                                             
              < Statement >
}
else if    
{
               < Statement>
}
else if    
{
                < Statement >
}
else
{
                  < Statement >
}

The execution of the above if else if else is as follows:-
 Firstly it will check the given condition, if the result of the given condition is True then the statements related, if the given condition is false then it will check the else if part and the condition of is true then the statements related to else if is Executed otherwise the pointer goes to next else if and this process is contained And if the result of the all the else if condition is false then the pointer is automatically goes to else part and the statement of the else automatically executed.

3.    NESTD IF - nested if means if within if and the general syntax of nested if is as follows.
              if
{
     if
{
         ;   }
else
{
         ;   }  }
else
{
          ;   }
      The execution of nested if is as follows:-

Firstly it will check the first condition, if the result of the first condition is True then it will check the next condition .if the result of next condition is also true then the statements are executed ased on the both of conditions. If the result of the first condition is true but the result of 2nd condition is false then the pointer is automatically goes to the else part of the 2nd if and if the result of 1st Condition is false then control is automatically goes to the else part of 1st if.