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

Subtract two numbers using method overriding

Subtract two numbers using method overriding   Program 1

3 months ago

PHP Star triangle Pattern program

PHP Star triangle Pattern program Here's a simple Java program that demonstrates how to print…

3 months ago

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,…

1 year 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…

1 year ago

Write temperature conversion program: Fahrenheit into Celsius

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

1 year 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…

1 year ago

This website uses cookies.