SlideShare a Scribd company logo
1 of 6
Programming & Algorithm Conditional Statements August 07, 2006
The  if  statement Form3: if ( expression ) statement1 else if ( expression ) statement2 else statement3 Form2: if ( expression ) statement1 else statement2 Form1: if ( expression ) statement1
The  depend on  statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The  if  statement &  depend on  statement  Statement1 will be executed when the variable equals to literal constant1. Statement2 will be executed when the variable equals to literal constant2. Statement3 will be executed when the variable equals to literal constant3. Statement4 will be executed when the variable doesn’t equal to any literal  constant. depend on (variable) equal to literal const1 : statement1 equal to literal const2 : statement2 equal to literal const3 : statement3 default : statement4 if (variable = literal const1) statement1 else if (variable = literal const2) statement2 else if (variable = literal const3) statement3 else statement4
Exercises ,[object Object],[object Object]
Exercises ,[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

A110-4 solving factored polys
A110-4 solving factored polysA110-4 solving factored polys
A110-4 solving factored polys
vhiggins1
 
Chapter3 basic java data types and declarations
Chapter3 basic java data types and declarationsChapter3 basic java data types and declarations
Chapter3 basic java data types and declarations
sshhzap
 

What's hot (20)

Selection Statements in C Programming
Selection Statements in C ProgrammingSelection Statements in C Programming
Selection Statements in C Programming
 
Derivatives
DerivativesDerivatives
Derivatives
 
C language control statements
C language  control statementsC language  control statements
C language control statements
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C ppt
 
Decision statements in c language
Decision statements in c languageDecision statements in c language
Decision statements in c language
 
Conditional statement
Conditional statementConditional statement
Conditional statement
 
A110-4 solving factored polys
A110-4 solving factored polysA110-4 solving factored polys
A110-4 solving factored polys
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Visula C# Programming Lecture 4
Visula C# Programming Lecture 4Visula C# Programming Lecture 4
Visula C# Programming Lecture 4
 
The Three Basic Selection Structures in C++ Programming Concepts
The Three Basic Selection Structures in C++ Programming ConceptsThe Three Basic Selection Structures in C++ Programming Concepts
The Three Basic Selection Structures in C++ Programming Concepts
 
Control statements and functions in c
Control statements and functions in cControl statements and functions in c
Control statements and functions in c
 
CalStatementsNAV2013
CalStatementsNAV2013CalStatementsNAV2013
CalStatementsNAV2013
 
Chapter3 basic java data types and declarations
Chapter3 basic java data types and declarationsChapter3 basic java data types and declarations
Chapter3 basic java data types and declarations
 
C programming decision making
C programming decision makingC programming decision making
C programming decision making
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__else
 
How to Program
How to ProgramHow to Program
How to Program
 
Learn Java Part 5
Learn Java Part 5Learn Java Part 5
Learn Java Part 5
 
Visula C# Programming Lecture 3
Visula C# Programming Lecture 3Visula C# Programming Lecture 3
Visula C# Programming Lecture 3
 
Control and conditional statements
Control and conditional statementsControl and conditional statements
Control and conditional statements
 

Similar to Conditional Statements [4]

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
alish 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_selection
alish sha
 
Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)
heoff
 
C statements.ppt presentation in c language
C statements.ppt presentation in c languageC statements.ppt presentation in c language
C statements.ppt presentation in c language
chintupro9
 

Similar to Conditional Statements [4] (20)

3-Conditional-if-else-switch btech computer in c.pdf
3-Conditional-if-else-switch btech computer in c.pdf3-Conditional-if-else-switch btech computer in c.pdf
3-Conditional-if-else-switch btech computer in c.pdf
 
SPL 7 | Conditional Statements in C
SPL 7 | Conditional Statements in CSPL 7 | Conditional Statements in C
SPL 7 | Conditional Statements in C
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
 
05. Conditional Statements
05. Conditional Statements05. Conditional Statements
05. Conditional Statements
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
 
Simple if else statement,nesting of if else statement & else if ladder
Simple if else statement,nesting of if else statement & else if ladderSimple if else statement,nesting of if else statement & else if ladder
Simple if else statement,nesting of if else statement & else if ladder
 
05 Conditional statements
05 Conditional statements05 Conditional statements
05 Conditional statements
 
Perl_Part2
Perl_Part2Perl_Part2
Perl_Part2
 
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
 
CH-4 (1).pptx
CH-4 (1).pptxCH-4 (1).pptx
CH-4 (1).pptx
 
Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)
 
Decision making and branching in c programming
Decision making and branching in c programmingDecision making and branching in c programming
Decision making and branching in c programming
 
C statements.ppt presentation in c language
C statements.ppt presentation in c languageC statements.ppt presentation in c language
C statements.ppt presentation in c language
 
04 a ch03_programacion
04 a ch03_programacion04 a ch03_programacion
04 a ch03_programacion
 
Ch5 Selection Statements
Ch5 Selection StatementsCh5 Selection Statements
Ch5 Selection Statements
 
Control All
Control AllControl All
Control All
 
Python decision making part4
Python decision making part4Python decision making part4
Python decision making part4
 
Control Statement programming
Control Statement programmingControl Statement programming
Control Statement programming
 
The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...
The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...
The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...
 

More from ecko_disasterz

Flow Chart & Input Output Statement [3] M
Flow Chart & Input Output Statement [3] MFlow Chart & Input Output Statement [3] M
Flow Chart & Input Output Statement [3] M
ecko_disasterz
 
Functions & Procedures [7]
Functions & Procedures [7]Functions & Procedures [7]
Functions & Procedures [7]
ecko_disasterz
 
Introduction To Algorithm [2]
Introduction To Algorithm [2]Introduction To Algorithm [2]
Introduction To Algorithm [2]
ecko_disasterz
 

More from ecko_disasterz (6)

Structures [8]
Structures [8]Structures [8]
Structures [8]
 
Flow Chart & Input Output Statement [3] M
Flow Chart & Input Output Statement [3] MFlow Chart & Input Output Statement [3] M
Flow Chart & Input Output Statement [3] M
 
Numeric Arrays [6]
Numeric Arrays [6]Numeric Arrays [6]
Numeric Arrays [6]
 
Functions & Procedures [7]
Functions & Procedures [7]Functions & Procedures [7]
Functions & Procedures [7]
 
Loop Statements [5] M
Loop Statements [5] MLoop Statements [5] M
Loop Statements [5] M
 
Introduction To Algorithm [2]
Introduction To Algorithm [2]Introduction To Algorithm [2]
Introduction To Algorithm [2]
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

Conditional Statements [4]

  • 1. Programming & Algorithm Conditional Statements August 07, 2006
  • 2. The if statement Form3: if ( expression ) statement1 else if ( expression ) statement2 else statement3 Form2: if ( expression ) statement1 else statement2 Form1: if ( expression ) statement1
  • 3.
  • 4. The if statement & depend on statement Statement1 will be executed when the variable equals to literal constant1. Statement2 will be executed when the variable equals to literal constant2. Statement3 will be executed when the variable equals to literal constant3. Statement4 will be executed when the variable doesn’t equal to any literal constant. depend on (variable) equal to literal const1 : statement1 equal to literal const2 : statement2 equal to literal const3 : statement3 default : statement4 if (variable = literal const1) statement1 else if (variable = literal const2) statement2 else if (variable = literal const3) statement3 else statement4
  • 5.
  • 6.