SlideShare a Scribd company logo
Mr. R.D.SIVAKUMAR, M.Sc.,M.Phil.,M.Tech.,
Assistant Professor of Computer Science &
Assistant Professor and Head, Department of M.Com.(CA),
Ayya Nadar Janaki Ammal College,
Sivakasi – 626 124.
Mobile: 099440-42243
e-mail : sivamsccsit@gmail.com
website: www.rdsivakumar.blogspot.in
Conditional Statements
Conditional Statements
if Statements
This is the most simple form of the branching statements. It takes an expression in
parenthesis and an statement or block of statements. if the expression is true then the
statement or block of statements gets executed otherwise these statements are
skipped.
Syntax:
The syntax of an if...else statement in C programming language is:
if(boolean_expression)
{
/* statement(s) will execute if the boolean expression is true */
}
Else
{ /* statement(s) will execute if the boolean expression is false */
}
4.5 Conditional Statements
Switch Statements
1. A switch statement allows a variable to be tested for equality against a list of
values. Each value is called a case, and the variable being switched on is checked
for each switch case.
Syntax:
The syntax for a switch statement in C programming language is as follows:
switch(expression)
{
case constant-expression :
statement(s);
break; /* optional */
case constant-expression :
statement(s);
break; /* optional */
/* you can have any number of case statements */ default : /* Optional */
statement(s);
}
Thank you..!!

More Related Content

PPT
PL/SQL Example for IF .. ELSIF
PDF
Dbms 6: ER Modeling
DOCX
Bt8903,c# programming
PDF
First order partial differential equations
PDF
Formation of partial differential equations by eliminating arbitrary functions
PPTX
Decision making and looping - c programming by YEASIN NEWAJ
PDF
Handout 2--Logic Based Sentence Editing
PPTX
Lec07 data hiding and encapsulation
PL/SQL Example for IF .. ELSIF
Dbms 6: ER Modeling
Bt8903,c# programming
First order partial differential equations
Formation of partial differential equations by eliminating arbitrary functions
Decision making and looping - c programming by YEASIN NEWAJ
Handout 2--Logic Based Sentence Editing
Lec07 data hiding and encapsulation

What's hot (9)

PPTX
Control Statements - R.D.Sivakumar
PPTX
c# keywords, identifiers and Naming Conventions
PDF
Continuity
PDF
Enhanced Entity-Relationship (EER) Modeling
PPT
Ch 4 E E R Biz Rules
PPTX
EER modeling
DOCX
Bt0074
PPTX
Keyword Presentation
PDF
Java- language Lecture 7
Control Statements - R.D.Sivakumar
c# keywords, identifiers and Naming Conventions
Continuity
Enhanced Entity-Relationship (EER) Modeling
Ch 4 E E R Biz Rules
EER modeling
Bt0074
Keyword Presentation
Java- language Lecture 7
Ad

More from Sivakumar R D . (20)

PPTX
Internet Connections and Its Protocols - R D Sivakumar
PPT
Internet - R D Sivakumar.
PPTX
Data Communication - R D Sivakumar
PPTX
NETWORK SERVICES - R D Sivakumar
PPTX
Computer Communications - R D Sivakumar
PPTX
Online Data Protection - R D Sivakumar
PPT
Software Engineering - R.D.Sivakumar
PPT
Different Kinds of Internet Protocols - R.D.Sivakumar
PPT
Internet - R.D.Sivakumar
PPT
Electronic Publishing Tools for E-Learning - R.D.Sivakumar
PPT
E-learning Packages - R.D.Sivakumar
PPT
Digital Communication - R.D.Sivakumar
PPT
Digigogy in Teaching - R.D.Sivakumar
PPT
Cyber Commerce Technology - R.D.Sivakumar
PPT
Video Lesson Creation - R.D.Sivakumar
PPT
Cognitive and Personal Dimensions of Cyber Learning - R.D.Sivakumar
PPT
Innovative Presentation - R.D.Sivakumar
PPT
Open Source in E-Learning - R.D.Sivakumar
PPTX
Tuxpaint - R.D.Sivakumar
PPT
Academic Blog Design - R.D.Sivakumar
Internet Connections and Its Protocols - R D Sivakumar
Internet - R D Sivakumar.
Data Communication - R D Sivakumar
NETWORK SERVICES - R D Sivakumar
Computer Communications - R D Sivakumar
Online Data Protection - R D Sivakumar
Software Engineering - R.D.Sivakumar
Different Kinds of Internet Protocols - R.D.Sivakumar
Internet - R.D.Sivakumar
Electronic Publishing Tools for E-Learning - R.D.Sivakumar
E-learning Packages - R.D.Sivakumar
Digital Communication - R.D.Sivakumar
Digigogy in Teaching - R.D.Sivakumar
Cyber Commerce Technology - R.D.Sivakumar
Video Lesson Creation - R.D.Sivakumar
Cognitive and Personal Dimensions of Cyber Learning - R.D.Sivakumar
Innovative Presentation - R.D.Sivakumar
Open Source in E-Learning - R.D.Sivakumar
Tuxpaint - R.D.Sivakumar
Academic Blog Design - R.D.Sivakumar
Ad

Recently uploaded (20)

PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
20th Century Theater, Methods, History.pptx
PDF
Computing-Curriculum for Schools in Ghana
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
Introduction to Building Materials
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
IGGE1 Understanding the Self1234567891011
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PDF
My India Quiz Book_20210205121199924.pdf
PDF
advance database management system book.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PDF
HVAC Specification 2024 according to central public works department
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
Chinmaya Tiranga quiz Grand Finale.pdf
20th Century Theater, Methods, History.pptx
Computing-Curriculum for Schools in Ghana
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
Weekly quiz Compilation Jan -July 25.pdf
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Introduction to Building Materials
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
History, Philosophy and sociology of education (1).pptx
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
IGGE1 Understanding the Self1234567891011
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
My India Quiz Book_20210205121199924.pdf
advance database management system book.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
HVAC Specification 2024 according to central public works department

Conditional Statements - R.D.Sivakumar

  • 1. Mr. R.D.SIVAKUMAR, M.Sc.,M.Phil.,M.Tech., Assistant Professor of Computer Science & Assistant Professor and Head, Department of M.Com.(CA), Ayya Nadar Janaki Ammal College, Sivakasi – 626 124. Mobile: 099440-42243 e-mail : sivamsccsit@gmail.com website: www.rdsivakumar.blogspot.in Conditional Statements
  • 2. Conditional Statements if Statements This is the most simple form of the branching statements. It takes an expression in parenthesis and an statement or block of statements. if the expression is true then the statement or block of statements gets executed otherwise these statements are skipped. Syntax: The syntax of an if...else statement in C programming language is: if(boolean_expression) { /* statement(s) will execute if the boolean expression is true */ } Else { /* statement(s) will execute if the boolean expression is false */ }
  • 3. 4.5 Conditional Statements Switch Statements 1. A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case. Syntax: The syntax for a switch statement in C programming language is as follows: switch(expression) { case constant-expression : statement(s); break; /* optional */ case constant-expression : statement(s); break; /* optional */ /* you can have any number of case statements */ default : /* Optional */ statement(s); }