SlideShare a Scribd company logo
3
Most read
4
Most read
11
Most read
Branching Structure
If
If else
Else if ladder
Nested if else
Four decision making statement
if
if-else
else if ladder
nested if else
If statement
It is generally used when we
want to check a single
condition.
Syntax:
if (condition)
{
Statement ;
}
START
if
(condition)
Statement
END
False
True
If else statement
If the given condition is true, then the
“if” block of code will be executed,
otherwise “else” block of code will be
executed.
Syntax:
if (condition 1)
{
Statement 1;
}
else
{
Statement 2;
}
START
If
(condition)
Statement 1
True
False
Statement 2
END
If statements in C
If statements in C
Else-if ladder statement
• The “else if” ladder is used to test set of conditions in a
sequence. It is also considered as multi-way decision
making statement.
• Number of conditions are given in a sequence with
subsequent statements. If any of the given condition is
satisfied then the related statements are executed and the
control exits from the else if ladder. That means further
conditions are not going to checked.
• If the condition does not satisfy then the compiler goes to
next condition to check the condition.
Else-if ladder statement
Syntax:
if (condition 1)
{
Statement 1;
}
else if ( condition 2)
{
Statement 2;
}
- - - - - - - - - -
else if (condition n)
{
Statement n;
}
else
{
Statement m;
}
Else-if ladder statement START
If
(condition1
)
If
(condition
n)
If
(condition2
)
False
Statement 1
True
END
True
Statement 2
False
True
Statement n
False
Default
Statement
If statements in C
Nested if-else statement
• Writing if statement inside another is known as nested if.
• While writing number of conditions, we may need to nest if
statement inside another if statement.
If statements in C
THANK YOU

More Related Content

PPTX
CONDITIONAL STATEMENT IN C LANGUAGE
PPTX
Decision statements in c language
PPTX
Dijkstra Searching Algorithms.pptx
PPTX
Looping statement
PPTX
C# Loops
PPTX
C if else
CONDITIONAL STATEMENT IN C LANGUAGE
Decision statements in c language
Dijkstra Searching Algorithms.pptx
Looping statement
C# Loops
C if else

What's hot (20)

ODP
OpenGurukul : Language : C Programming
PPTX
C Programming: Control Structure
PPTX
The Loops
PPT
Control structures in C++ Programming Language
PPTX
Conditional statement c++
PPTX
Presentation on C Switch Case Statements
PPTX
Theory of competition topic simplification of cfg, normal form of FG.pptx
PPTX
If else statement in c++
PPSX
C lecture 4 nested loops and jumping statements slideshare
PPTX
Inheritance in JAVA PPT
PPTX
Pseudocode-Flowchart
PPTX
Complex integration
PPTX
Lexical analyzer generator lex
PPTX
Type conversion, precedence, associativity in c programming
PPTX
Control structure of c
PPTX
What is Switch Case?
PPTX
Structures in c language
PPTX
Loaders ( system programming )
PPTX
Type casting in c programming
PDF
itft-Decision making and branching in java
OpenGurukul : Language : C Programming
C Programming: Control Structure
The Loops
Control structures in C++ Programming Language
Conditional statement c++
Presentation on C Switch Case Statements
Theory of competition topic simplification of cfg, normal form of FG.pptx
If else statement in c++
C lecture 4 nested loops and jumping statements slideshare
Inheritance in JAVA PPT
Pseudocode-Flowchart
Complex integration
Lexical analyzer generator lex
Type conversion, precedence, associativity in c programming
Control structure of c
What is Switch Case?
Structures in c language
Loaders ( system programming )
Type casting in c programming
itft-Decision making and branching in java
Ad

Similar to If statements in C (20)

PPTX
Selection structure
PPTX
Control statements in java
PPTX
IF & SWITCH (conditional control) in computer science
DOCX
Chapter 4(1)
PPT
control-statements detailed presentation
PPTX
Decision control structures
PPTX
Unit_3A_If_Else_Switch and a if else statment example
PPTX
Conditional statement in c
PPTX
C Programming: Control Statements in C Pgm
PPTX
Kotlin If Else Statement Explained
PPTX
Decision Making Statement in C ppt
PPTX
Lec-5-IF-ELSE-SWITCH Programming Fundamentals.pptx
PPTX
Conditional Statement-pptx-lesson3asdfsa
PPTX
Selection statements
PPTX
Conditional Statements . Ppt group presentation
PPTX
DECISION MAKING AND BRANCHING - C Programming
PPTX
What are conditional statements?
PPTX
If statements in c programming
PPTX
Programming in java - Concepts- Operators- Control statements-Expressions
Selection structure
Control statements in java
IF & SWITCH (conditional control) in computer science
Chapter 4(1)
control-statements detailed presentation
Decision control structures
Unit_3A_If_Else_Switch and a if else statment example
Conditional statement in c
C Programming: Control Statements in C Pgm
Kotlin If Else Statement Explained
Decision Making Statement in C ppt
Lec-5-IF-ELSE-SWITCH Programming Fundamentals.pptx
Conditional Statement-pptx-lesson3asdfsa
Selection statements
Conditional Statements . Ppt group presentation
DECISION MAKING AND BRANCHING - C Programming
What are conditional statements?
If statements in c programming
Programming in java - Concepts- Operators- Control statements-Expressions
Ad

More from Megha Sharma (20)

PPTX
Designing Printed Circuit boards, Software Choices, The Design Process
PPTX
Manufacturing PCB, Etching board, milling board, Third party manufacturing, a...
PPTX
Business Model, make thing, sell thing, subscription, customization, Key Reso...
PPTX
Funding an IOT startup, Venture Capital, Government funding, Crowdfunding, Le...
PPTX
Sketch, Iterate and Explore, Nondigital Methods.
PPTX
CNC Milling, Software, Repurposing and Recycling.
PPTX
3D printing, Types of 3D printing: FDM, Laser Sintering, Powder bed, LOM, DLP.
PPTX
Laser Cutting, Choosing a laser cutter, Software, Hinges and joints.
PPTX
Memory management, Types of memory, Making the most of your RAM.
PPTX
Performance and Battery Life, Libraries, Debugging.
PPTX
Prototyping Embedded Devices: Arduino, Developing on the Arduino.
PPTX
Raspberry-Pi, Developing on Raspberry Pi, Difference between Arduino & Raspbe...
PPTX
Open Source versus Closed Source in IOT in IOT
PPTX
Why closed? Why Open? Mixing open and closed source
PPTX
Model Performance Metrics. Accuracy, Precision, Recall
PPTX
Graceful Degradation and Affordance in IOT
PPTX
Web thinking connected device, Small Pieces Loosely joined.
PPTX
Production & Mass Personalization, Changing Embedded Platform, Physical proto...
PPTX
Whose data is it anyways? Public vs Private data collection.
PPTX
Thinking about Prototyping: Sketching, Familiarity, Cost versus Ease of proto...
Designing Printed Circuit boards, Software Choices, The Design Process
Manufacturing PCB, Etching board, milling board, Third party manufacturing, a...
Business Model, make thing, sell thing, subscription, customization, Key Reso...
Funding an IOT startup, Venture Capital, Government funding, Crowdfunding, Le...
Sketch, Iterate and Explore, Nondigital Methods.
CNC Milling, Software, Repurposing and Recycling.
3D printing, Types of 3D printing: FDM, Laser Sintering, Powder bed, LOM, DLP.
Laser Cutting, Choosing a laser cutter, Software, Hinges and joints.
Memory management, Types of memory, Making the most of your RAM.
Performance and Battery Life, Libraries, Debugging.
Prototyping Embedded Devices: Arduino, Developing on the Arduino.
Raspberry-Pi, Developing on Raspberry Pi, Difference between Arduino & Raspbe...
Open Source versus Closed Source in IOT in IOT
Why closed? Why Open? Mixing open and closed source
Model Performance Metrics. Accuracy, Precision, Recall
Graceful Degradation and Affordance in IOT
Web thinking connected device, Small Pieces Loosely joined.
Production & Mass Personalization, Changing Embedded Platform, Physical proto...
Whose data is it anyways? Public vs Private data collection.
Thinking about Prototyping: Sketching, Familiarity, Cost versus Ease of proto...

Recently uploaded (20)

PPTX
History, Philosophy and sociology of education (1).pptx
PDF
What if we spent less time fighting change, and more time building what’s rig...
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Introduction to Building Materials
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PPTX
Lesson notes of climatology university.
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
History, Philosophy and sociology of education (1).pptx
What if we spent less time fighting change, and more time building what’s rig...
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
Chinmaya Tiranga quiz Grand Finale.pdf
RMMM.pdf make it easy to upload and study
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Introduction to Building Materials
LDMMIA Reiki Yoga Finals Review Spring Summer
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Final Presentation General Medicine 03-08-2024.pptx
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
Weekly quiz Compilation Jan -July 25.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Lesson notes of climatology university.
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...

If statements in C

  • 1. Branching Structure If If else Else if ladder Nested if else
  • 2. Four decision making statement if if-else else if ladder nested if else
  • 3. If statement It is generally used when we want to check a single condition. Syntax: if (condition) { Statement ; } START if (condition) Statement END False True
  • 4. If else statement If the given condition is true, then the “if” block of code will be executed, otherwise “else” block of code will be executed. Syntax: if (condition 1) { Statement 1; } else { Statement 2; } START If (condition) Statement 1 True False Statement 2 END
  • 7. Else-if ladder statement • The “else if” ladder is used to test set of conditions in a sequence. It is also considered as multi-way decision making statement. • Number of conditions are given in a sequence with subsequent statements. If any of the given condition is satisfied then the related statements are executed and the control exits from the else if ladder. That means further conditions are not going to checked. • If the condition does not satisfy then the compiler goes to next condition to check the condition.
  • 8. Else-if ladder statement Syntax: if (condition 1) { Statement 1; } else if ( condition 2) { Statement 2; } - - - - - - - - - - else if (condition n) { Statement n; } else { Statement m; }
  • 9. Else-if ladder statement START If (condition1 ) If (condition n) If (condition2 ) False Statement 1 True END True Statement 2 False True Statement n False Default Statement
  • 11. Nested if-else statement • Writing if statement inside another is known as nested if. • While writing number of conditions, we may need to nest if statement inside another if statement.