SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
Flow Control
Statements in C/C++
By: Er. Aman Kumar
Statement is instruction
that execute at run
time
Type of statements
1. Sequential statement
2. Conditional statement
3. iterative/looping
statement
4. Branching statement
Sequential
statement
• These are those
statements which
execute starting from
line1 to line 2 and so on.
• Till now the programs
we have done are
example of sequential
statements as
lines/statements in
programs are executed
in the sequence as
Conditional
statement
• Are those statements which will depend
on condition for their execution.
Types of Conditional Statements
• If condition
• if-else condition
• Nested if-else
• If-else ladder
if
condition
if(condition)
{
statement1
;
statement2
;
..........
}
Stament1 and statement2 are conditional
their
WAP to find greatest of 2
numbers using if
condition
• lvalue : An expression that is an
lvalue may appear as either the left-
hand or right-hand side of an
assignment.
way2ITec
h
Outpu
t
Hello
if-else
condition
• if evaluates to true. It does nothing
when the expression evaluates to
false.
• Else is used when we want some
statements to be executed when if
evaluates to be false. So if the
condition is true, if is executed else
, else is executed.
If(condition)
{
Statement
1;
Statement
2;
}
else
{
Statement
3;
way2ITec
h
way2ITec
h
Progra
m
• WAP to enter Small Case Character
And Output Upper Case Character
and When input character is Upper
case, Output small case character
way2ITec
h
Nested if-
else
• if-else construct within either the body
of the if statement or the body of an
else statement or both. This is called
nesting‘of ifs.
Progra
m
• WAP to find greatest of 3 numbers
using nested if-else
If-else
Ladder
• It is used to check multiple
conditions.
• Every else is associated with its
previous if.
• The last else goes to work only if all
the conditions fail.
• Even in else if ladder the last
else is optional.
• WAP to calculate tax for entered salary.
If salary > 10000, tax is 2 %. If salary
lies between 5000 and 10000, tax is
1.5 %. If salary is in between 3000 to
5000 , Tax is 1 % and if salary is lesser
then 3000, Tax is 0%
conditional.pptx
conditional.pptx

Más contenido relacionado

Similar a conditional.pptx

[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++Muhammad Hammad Waseem
 
Control statements anil
Control statements anilControl statements anil
Control statements anilAnil Dutt
 
What are conditional statements?
What are conditional statements?What are conditional statements?
What are conditional statements?AnuragSrivastava272
 
CIS 1403 lab 4 selection
CIS 1403 lab 4 selectionCIS 1403 lab 4 selection
CIS 1403 lab 4 selectionHamad Odhabi
 
Control statements in java
Control statements in javaControl statements in java
Control statements in javaManojkumar C
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Syed Farjad Zia Zaidi
 
C statements
C statementsC statements
C statementsAhsann111
 
10. switch case
10. switch case10. switch case
10. switch caseWay2itech
 
Selection statements
Selection statementsSelection statements
Selection statementsHarsh Dabas
 
Ch5 Selection Statements
Ch5 Selection StatementsCh5 Selection Statements
Ch5 Selection StatementsSzeChingChen
 
If statements in C
If statements in CIf statements in C
If statements in CMegha Sharma
 
Dti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selectionDti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selectionalish sha
 
Dti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selectionDti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selectionalish sha
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C pptMANJUTRIPATHI7
 

Similar a conditional.pptx (20)

[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
 
Control statements anil
Control statements anilControl statements anil
Control statements anil
 
What are conditional statements?
What are conditional statements?What are conditional statements?
What are conditional statements?
 
CIS 1403 lab 4 selection
CIS 1403 lab 4 selectionCIS 1403 lab 4 selection
CIS 1403 lab 4 selection
 
Control statements in java
Control statements in javaControl statements in java
Control statements in java
 
LOOPS AND DECISIONS
LOOPS AND DECISIONSLOOPS AND DECISIONS
LOOPS AND DECISIONS
 
Controls & Loops in C
Controls & Loops in C Controls & Loops in C
Controls & Loops in C
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2
 
C statements
C statementsC statements
C statements
 
Using decision statements
Using decision statementsUsing decision statements
Using decision statements
 
Introducing Swift v2.1
Introducing Swift v2.1Introducing Swift v2.1
Introducing Swift v2.1
 
[ITP - Lecture 11] Loops in C/C++
[ITP - Lecture 11] Loops in C/C++[ITP - Lecture 11] Loops in C/C++
[ITP - Lecture 11] Loops in C/C++
 
10. switch case
10. switch case10. switch case
10. switch case
 
Selection statements
Selection statementsSelection statements
Selection statements
 
UNIT 2 PPT.pdf
UNIT 2 PPT.pdfUNIT 2 PPT.pdf
UNIT 2 PPT.pdf
 
Ch5 Selection Statements
Ch5 Selection StatementsCh5 Selection Statements
Ch5 Selection Statements
 
If statements in C
If statements in CIf statements in C
If statements in C
 
Dti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selectionDti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selection
 
Dti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selectionDti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selection
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C ppt
 

Más de AbhinayKammakol

numerical aperture of a optical fibre.pptx
numerical aperture of a optical fibre.pptxnumerical aperture of a optical fibre.pptx
numerical aperture of a optical fibre.pptxAbhinayKammakol
 
smartnotetaker-160912144256.pdf
smartnotetaker-160912144256.pdfsmartnotetaker-160912144256.pdf
smartnotetaker-160912144256.pdfAbhinayKammakol
 
PowerPoint_merge.ppt.pptx
PowerPoint_merge.ppt.pptxPowerPoint_merge.ppt.pptx
PowerPoint_merge.ppt.pptxAbhinayKammakol
 
HOW 12 Confused-Missused.pptx
HOW 12 Confused-Missused.pptxHOW 12 Confused-Missused.pptx
HOW 12 Confused-Missused.pptxAbhinayKammakol
 

Más de AbhinayKammakol (7)

WORD FORMATION.pptx
WORD FORMATION.pptxWORD FORMATION.pptx
WORD FORMATION.pptx
 
numerical aperture of a optical fibre.pptx
numerical aperture of a optical fibre.pptxnumerical aperture of a optical fibre.pptx
numerical aperture of a optical fibre.pptx
 
control statements.pptx
control statements.pptxcontrol statements.pptx
control statements.pptx
 
smartnotetaker-160912144256.pdf
smartnotetaker-160912144256.pdfsmartnotetaker-160912144256.pdf
smartnotetaker-160912144256.pdf
 
PowerPoint_merge.ppt.pptx
PowerPoint_merge.ppt.pptxPowerPoint_merge.ppt.pptx
PowerPoint_merge.ppt.pptx
 
HOW 12 Confused-Missused.pptx
HOW 12 Confused-Missused.pptxHOW 12 Confused-Missused.pptx
HOW 12 Confused-Missused.pptx
 
Semiconductor.pptx
Semiconductor.pptxSemiconductor.pptx
Semiconductor.pptx
 

Último

Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsResearcher Researcher
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESkarthi keyan
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Romil Mishra
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 
70 POWER PLANT IAE V2500 technical training
70 POWER PLANT IAE V2500 technical training70 POWER PLANT IAE V2500 technical training
70 POWER PLANT IAE V2500 technical trainingGladiatorsKasper
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
STATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subjectSTATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subjectGayathriM270621
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organizationchnrketan
 
Curve setting (Basic Mine Surveying)_MI10412MI.pptx
Curve setting (Basic Mine Surveying)_MI10412MI.pptxCurve setting (Basic Mine Surveying)_MI10412MI.pptx
Curve setting (Basic Mine Surveying)_MI10412MI.pptxRomil Mishra
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
Detection&Tracking - Thermal imaging object detection and tracking
Detection&Tracking - Thermal imaging object detection and trackingDetection&Tracking - Thermal imaging object detection and tracking
Detection&Tracking - Thermal imaging object detection and trackinghadarpinhas1
 
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...gerogepatton
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...Erbil Polytechnic University
 

Último (20)

Versatile Engineering Construction Firms
Versatile Engineering Construction FirmsVersatile Engineering Construction Firms
Versatile Engineering Construction Firms
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending Actuators
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 
70 POWER PLANT IAE V2500 technical training
70 POWER PLANT IAE V2500 technical training70 POWER PLANT IAE V2500 technical training
70 POWER PLANT IAE V2500 technical training
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptx
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
STATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subjectSTATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subject
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organization
 
Curve setting (Basic Mine Surveying)_MI10412MI.pptx
Curve setting (Basic Mine Surveying)_MI10412MI.pptxCurve setting (Basic Mine Surveying)_MI10412MI.pptx
Curve setting (Basic Mine Surveying)_MI10412MI.pptx
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
Detection&Tracking - Thermal imaging object detection and tracking
Detection&Tracking - Thermal imaging object detection and trackingDetection&Tracking - Thermal imaging object detection and tracking
Detection&Tracking - Thermal imaging object detection and tracking
 
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...
 

conditional.pptx