Nested if statement in C


Nested if statement in C 

The Else clause like the If clause can contain compound statements.

Moreover, a clause of the if statement may contain another if statement. This key feature is known as nesting of if statements.

There are several formats nested if else statement can take.

The most general form of two layer nesting is

        if(condition1)
        {
                if(condition2)
                {
                        Statement1;
                }
                else
                {
                        Statement2;
                }
        }
        else
        {
                Statement3;
         }


The flow chart for nested if statement is as follows,
nested if statement in c


Example program:

The above program is a c program to find the greatest among three numbers using nested if statement. 


Output:




Thank you …

Please Show your support by subscribing to my post below…

Previous Post
Next Post
Related Posts

0 comments:

Popular Posts