C++

Nested if in C++ Programming Language

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

Syntax

 

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

Example

 

When we executed the above program, it produced the following result

your marks is enougn
you can enter university

Program 2

Example

 

When we executed the above program, it produced the following result

you are pass

Similar post

If statement in C++ language

If statements in Java language

If statements in Python programming

If statement in C language

Karmehavannan

Recent Posts

Using function or method to Write temperature conversion : Fahrenheit into Celsius

Using Function or Method to Write to temperature conversion: Fahrenheit into Celsius In this article,…

11 months ago

Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user

Function or method of temperature conversion from Fahrenheit into Celsius In this article, we will…

11 months ago

Write temperature conversion program: Fahrenheit into Celsius

Write temperature conversion program: from Fahrenheit to Celsius In this article, we will discuss the…

11 months ago

How to write a program to convert Fahrenheit into Celsius

How to write a program to convert Fahrenheit into Celsius In this article, we will…

11 months ago

Function/method to convert Celsius into Fahrenheit -Entered by user

Function/method to convert Celsius into Fahrenheit -Entered by user In this article, we will discuss…

11 months ago

Temperature conversion: Celsius into Fahrenheit using function or method

Temperature conversion: Celsius into Fahrenheit using a function or method In this article, we will…

11 months ago

This website uses cookies.