Nested if in C programming Language

Nested if in C programming Language

In this tutorial, we will discuss the Nested if in C programming Language.
The nested if-else statement refers to the use of one if-else statement inside another if-else statement. Inside means, one or more condition is evaluated by the nested if statement. 
In nested if statement, when the condition becomes true, if part is executed and displays statement and then enters the next inner-if loop. When the condition becomes false, else part is executed and else part statement is displayed. Then, it may exit or terminate the nested if loop.

 

Syntex

The syntax of nested if in C Language 

Syntax


Explanation of nested if

Syntax – Explanation

Flow diagram

The flow diagram for Nested if in C
flow diagram

Program 1

Example

When you execute the above code, it produces the following result

Enter the first number for a:
1
Enter the second number for b:
2
Enter the third number for c:
3

1 is smaller than 2

In the above program, the program allows users to enter three number for compaison and then an output is displayed.

 

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.