Overview of Nested
It is perfectly all right if we write an entire
if...else construct within either the body of the if statement or the body of an else statement. This is called ‘nesting’of ifs.
Nested Syntax of Nested Rules can be described for applying nested Flow Diagram Example:- Output:
if...else statements has ability to control program flow based on multiple levels of condition.
// Statements inside body of if
//Statements inside body of else if
//Statements inside body of else
if...else can be chained with one another.
else block where condition is again checked with if statement. The process continues if there is no
if statement in the last
if statement satisfies the condition, other nested
else.. if will not be executed.
// Program to check whether an integer entered by the user is odd or even
printf("Enter an integer: ");
// True if remainder is 0
if( number%2 == 0 )
printf("%d is an even integer.",number);
printf("%d is an odd integer.",number);
Enter an integer: 7
7 is an odd integer.
Syntax of Nested
Rules can be described for applying nested