Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

Nested if in C programming Language

Posted on August 29, 2017October 20, 2019

Table of Contents

  • Nested if in C programming Language
    • Syntex
    • Flow diagram

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 

Nested if in C
Syntax


Explanation of nested if

Nested if in C
Syntax – Explanation

Flow diagram

The flow diagram for Nested if in C
Nested if in C
flow diagram

Program 1

Nested if in C
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.

 

Related post

If statement in C++

Nested while loop in C Language
Nested while loop in Java

 

 

 

Related

Recent Posts

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes