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
Subtract two numbers using method overriding Program 1
PHP Star triangle Pattern program Here's a simple Java program that demonstrates how to print…
Using Function or Method to Write to temperature conversion: Fahrenheit into Celsius In this article,…
Function or method of temperature conversion from Fahrenheit into Celsius In this article, we will…
Write temperature conversion program: from Fahrenheit to Celsius In this article, we will discuss the…
How to write a program to convert Fahrenheit into Celsius In this article, we will…
This website uses cookies.