Table of Contents
Nested if in C programming Language
In this tutorial, we will discuss the Nested if in C programming Language.
The nested if-else statement refers to the use of one if-else statement inside another if-else statement. Inside means, one or more condition is evaluated by the nested if statement.
In nested if statement, when the condition becomes true, if part is executed and displays statement and then enters the next inner-if loop. When the condition becomes false, else part is executed and else part statement is displayed. Then, it may exit or terminate the nested if loop.
Syntex
The syntax of nested if in C Language
Explanation of nested if
Flow diagram
The flow diagram for Nested if in C
Program 1
When you execute the above code, it produces the following result
Enter the first number for a:
1
Enter the second number for b:
2
Enter the third number for c:
3
1 is smaller than 2
In the above program, the program allows users to enter three number for compaison and then an output is displayed.