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
    • Related

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

  • Multiply two numbers in Java using scanner| 5 different ways
  • 5 different ways to Divide two numbers in Java using scanner
  • Learn 8 Ways to Subtract Two Numbers Using Methods in Java
  • 10 ways to subtract two numbers in Java
  • Java Code Examples – Multiply Two Numbers in 5 Easy Ways
  • How to Divide two numbers in Java| 5 different ways

tag

Addition (8) Array (38) C++ language (91) C language (98) c sharp (23) Division (8) Function (29) if else (32) Java language (108) JavaScript (5) loops (138) Multiply (8) Oop (2) patterns (66) PHP (13) Python Language (38) Subtraction (9) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2026 Code for Java c | Powered by SuperbThemes