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

Multiply two numbers in Java using scanner| 5 different ways

Multiply two numbers in Java using scanner| 5 different ways In this article, we will…

3 months ago

5 different ways to Divide two numbers in Java using scanner

5 Different ways to Divide two numbers in Java using scanner In this article, we…

3 months ago

Learn 8 Ways to Subtract Two Numbers Using Methods in Java

Learn 8 Ways to Subtract Two Numbers Using Methods in Java In this article, we…

4 months ago

10 ways to subtract two numbers in Java

10 ways to subtract two numbers in Java In this article, we will discuss the…

4 months ago

Java Code Examples – Multiply Two Numbers in 5 Easy Ways

Java Code Examples – Multiply Two Numbers in 5 Easy Ways In this article, we…

4 months ago

How to Divide two numbers in Java| 5 different ways

How to Divide two numbers in Java| 5 different ways In this article, we will…

4 months ago

This website uses cookies.