Table of Contents
Nested if in C++ programming Language
In this tutorial, we will discuss the Nested if in C++ language
In C++, use of if statement in another if block or another else block is known as nesting if. So, it can be used in more than one if block in one program.
Syntex
Flow diagram
In the above diagram, first,The outer-if statements evaluates the test expression(boolean expression)
When the test expression is evaluated to true codes inside the body of outer-if is executed and the statements inside the body of outer-else are skipped
Then the control moves to inner-if to check test expression
When the test expression is evaluated to true codes inside the body of inner-if is executed and body of inner-else are skipped
when the test expression is evaluated to false inside the body of inner if is skipped and inside the body of inner-else are executed
Example 1
When we executed the above program, it produced the following result
your marks is enougn you can enter university
Program 2
When we executed the above program, it produced the following result
you are pass
Similar post
If statements in Java language