If Else Ladder / Else-If Clause :
Syntax :
#include<stdio.h> if(expression1) statement1; else if(expression2) statement2; else if(expression3) statement3; else statement4;
Explanation :
- Conditions are evaluated from Top to Bottom
- As soon as TRUE expression is found the statement associated with it is executed and rest of the ladder is Bypassed
Click on Image to Enlarge
Sample Example : ( To find the Grade of the Student)
if (marks >= 67 )
printf("Distinction");
else if (marks >=60)
printf("First Class");
else if (marks >=55)
printf("Higher Second Class");
else if (marks >=50)
printf("Second Class");
else if (marks >=40)
printf("Pass Class");
else
printf("Fail");
| Previous : If-Else Statement in C Programming | Decision Making Home | Next Tutorial : Nested If-Else Statement |

0 comments
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email