Table of Contents
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.
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
Multiply two numbers in Java using scanner| 5 different ways In this article, we will…
5 Different ways to Divide two numbers in Java using scanner In this article, we…
Learn 8 Ways to Subtract Two Numbers Using Methods in Java In this article, we…
10 ways to subtract two numbers in Java In this article, we will discuss the…
Java Code Examples – Multiply Two Numbers in 5 Easy Ways In this article, we…
How to Divide two numbers in Java| 5 different ways In this article, we will…
This website uses cookies.