Nested-if Statements in C Language

aimtocode

Nested-If Statement

A nested if is an if statement that is the target of another if or else. Nested ifs are very common in programming.

When you use nested if, the main thing to remember is that an else statement always refers to the nearest if statement that is within the same block as the else and that is not already associated with an else.

Syntax:

Flowchart:

Example:



Output:

 i is smaller than 15
 i is smaller than 12 too


Read Also:


aimtocode