Else if ladder in C


Else if ladder in C

The conditions are checked from top of the ladder to the bottom.

If the condition is true in the particular ladder, it executes the statement associated with it and skipping the rest of the ladder and the control is transferred out of the ladder.

When all the conditions are false it executes the default statement present in the else part of the loop.

The syntax of else if ladder is as follows,

if(condition 1)
{
Statement 1;
}
else if(condition 2)
{
Statement 2;
}
else if(condition n)
{
Statement n;
}
else
{
Default statement;
}

The flow chat of else if ladder is as follows,


Example program:

The below program is the program to find the smallest among three numbers using else if ladder.

else if ladder


Output:




Thank you ….

Please show your support by subscribing to my post below..

    

Popular Posts