SlideShare a Scribd company logo
1 of 40
A First Book of ANSI C Fourth Edition Chapter 4 Selection
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Introduction ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Relational Expressions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Relational Expressions (continued)
Relational Expressions (continued)
Relational Expressions (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Relational Expressions (continued)
Logical Operators ,[object Object],[object Object]
Logical Operators (continued)
Logical Operators (continued)
Logical Operators (continued)
Logical Operators (continued) ,[object Object],[object Object]
Logical Operators (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Logical Operators (continued)
Logical Operators (continued) ,[object Object],[object Object],[object Object]
The  if  and  if-else  Statements No semicolon here One-way  if  statement
The  if  and  if-else  Statements (continued)
Compound Statements ,[object Object]
Compound Statements (continued)
Compound Statements (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The  if-else  Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The  if-else  Statement (continued)
The  if-else  Statement (continued)
The  if-else  Statement (continued)
The  if-else  Chain ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The  if-else  Chain (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The  if-else  Chain (continued)
The  if-else  Chain (continued)
The  if-else  Chain (continued)
The  if-else  Chain (continued)
The  switch  Statement Terminated with a colon default  is optional If the  break  statement was omitted, the following  case  would be executed
The  switch  Statement (continued)
The  switch  Statement (continued)
Case Study: Data Validation ,[object Object],[object Object],[object Object],[object Object]
Case Study: Data Validation (continued)
Common Programming Errors ,[object Object],[object Object],[object Object],[object Object]
Common Compiler Errors
Summary ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary (continued) ,[object Object],[object Object],[object Object]

More Related Content

What's hot

C programming | Class 8 | III Term
C programming  | Class 8  | III TermC programming  | Class 8  | III Term
C programming | Class 8 | III TermAndrew Raj
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageRakesh Roshan
 
Overview of C Mrs Sowmya Jyothi
Overview of C Mrs Sowmya JyothiOverview of C Mrs Sowmya Jyothi
Overview of C Mrs Sowmya JyothiSowmya Jyothi
 
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHMCLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHMRc Os
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to cHattori Sidek
 
Constants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya JyothiConstants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya JyothiSowmyaJyothi3
 
Ch5 Selection Statements
Ch5 Selection StatementsCh5 Selection Statements
Ch5 Selection StatementsSzeChingChen
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CSowmya Jyothi
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software developmentHattori Sidek
 
Ap Power Point Chpt3 B
Ap Power Point Chpt3 BAp Power Point Chpt3 B
Ap Power Point Chpt3 Bdplunkett
 
Control structures functions and modules in python programming
Control structures functions and modules in python programmingControl structures functions and modules in python programming
Control structures functions and modules in python programmingSrinivas Narasegouda
 
Control Structures
Control StructuresControl Structures
Control StructuresGhaffar Khan
 

What's hot (19)

C programming | Class 8 | III Term
C programming  | Class 8  | III TermC programming  | Class 8  | III Term
C programming | Class 8 | III Term
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
 
Overview of C Mrs Sowmya Jyothi
Overview of C Mrs Sowmya JyothiOverview of C Mrs Sowmya Jyothi
Overview of C Mrs Sowmya Jyothi
 
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHMCLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetition
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statements
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
Python Objects
Python ObjectsPython Objects
Python Objects
 
Constants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya JyothiConstants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya Jyothi
 
Ch5 Selection Statements
Ch5 Selection StatementsCh5 Selection Statements
Ch5 Selection Statements
 
Cp module 2
Cp module 2Cp module 2
Cp module 2
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in C
 
Looping
LoopingLooping
Looping
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software development
 
Function
FunctionFunction
Function
 
Ap Power Point Chpt3 B
Ap Power Point Chpt3 BAp Power Point Chpt3 B
Ap Power Point Chpt3 B
 
cp Module4(1)
cp Module4(1)cp Module4(1)
cp Module4(1)
 
Control structures functions and modules in python programming
Control structures functions and modules in python programmingControl structures functions and modules in python programming
Control structures functions and modules in python programming
 
Control Structures
Control StructuresControl Structures
Control Structures
 

Similar to Ch04

Ap Power Point Chpt3
Ap Power Point Chpt3Ap Power Point Chpt3
Ap Power Point Chpt3dplunkett
 
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 languagechintupro9
 
C language UPTU Unit3 Slides
C language UPTU Unit3 SlidesC language UPTU Unit3 Slides
C language UPTU Unit3 SlidesRakesh Roshan
 
Chapter 4 flow control structures and arrays
Chapter 4 flow control structures and arraysChapter 4 flow control structures and arrays
Chapter 4 flow control structures and arrayssshhzap
 
Cprogrammingprogramcontrols
CprogrammingprogramcontrolsCprogrammingprogramcontrols
Cprogrammingprogramcontrolsteach4uin
 
CIS 1403 lab 4 selection
CIS 1403 lab 4 selectionCIS 1403 lab 4 selection
CIS 1403 lab 4 selectionHamad Odhabi
 
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
 
Cse lecture-6-c control statement
Cse lecture-6-c control statementCse lecture-6-c control statement
Cse lecture-6-c control statementFarshidKhan
 
Control structures i
Control structures i Control structures i
Control structures i Ahmad Idrees
 
Chap11 (ICS12).pdf
Chap11 (ICS12).pdfChap11 (ICS12).pdf
Chap11 (ICS12).pdfJounAbbas4
 
Introduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow controlIntroduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow controlENGWAU TONNY
 

Similar to Ch04 (20)

Ap Power Point Chpt3
Ap Power Point Chpt3Ap Power Point Chpt3
Ap Power Point Chpt3
 
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
 
slides03.ppt
slides03.pptslides03.ppt
slides03.ppt
 
C language UPTU Unit3 Slides
C language UPTU Unit3 SlidesC language UPTU Unit3 Slides
C language UPTU Unit3 Slides
 
Ppt lesson 08
Ppt lesson 08Ppt lesson 08
Ppt lesson 08
 
Ch05.pdf
Ch05.pdfCh05.pdf
Ch05.pdf
 
Chapter 4 flow control structures and arrays
Chapter 4 flow control structures and arraysChapter 4 flow control structures and arrays
Chapter 4 flow control structures and arrays
 
Cprogrammingprogramcontrols
CprogrammingprogramcontrolsCprogrammingprogramcontrols
Cprogrammingprogramcontrols
 
CIS 1403 lab 4 selection
CIS 1403 lab 4 selectionCIS 1403 lab 4 selection
CIS 1403 lab 4 selection
 
Control All
Control AllControl All
Control All
 
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
 
Cse lecture-6-c control statement
Cse lecture-6-c control statementCse lecture-6-c control statement
Cse lecture-6-c control statement
 
Control structures i
Control structures i Control structures i
Control structures i
 
Control Statement programming
Control Statement programmingControl Statement programming
Control Statement programming
 
Control statments in c
Control statments in cControl statments in c
Control statments in c
 
Ch05-converted.pptx
Ch05-converted.pptxCh05-converted.pptx
Ch05-converted.pptx
 
Chap11 (ICS12).pdf
Chap11 (ICS12).pdfChap11 (ICS12).pdf
Chap11 (ICS12).pdf
 
Introduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow controlIntroduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow control
 
Ternary operator
Ternary operatorTernary operator
Ternary operator
 

More from Arriz San Juan

More from Arriz San Juan (13)

Session 6 merchandising1
Session 6 merchandising1Session 6 merchandising1
Session 6 merchandising1
 
9. logic gates._rr
9. logic gates._rr9. logic gates._rr
9. logic gates._rr
 
7. kirchhoff s_rules
7. kirchhoff s_rules7. kirchhoff s_rules
7. kirchhoff s_rules
 
9. transistors.rr
9. transistors.rr9. transistors.rr
9. transistors.rr
 
12 exception handling
12 exception handling12 exception handling
12 exception handling
 
12 exception handling
12 exception handling12 exception handling
12 exception handling
 
Chap 17 controlling
Chap 17 controllingChap 17 controlling
Chap 17 controlling
 
11 advance inheritance_concepts
11 advance inheritance_concepts11 advance inheritance_concepts
11 advance inheritance_concepts
 
9. transistors.rr
9. transistors.rr9. transistors.rr
9. transistors.rr
 
8. semiconductors.rr
8. semiconductors.rr8. semiconductors.rr
8. semiconductors.rr
 
7. kirchhoff s_rules
7. kirchhoff s_rules7. kirchhoff s_rules
7. kirchhoff s_rules
 
Ch13
Ch13Ch13
Ch13
 
Ch07
Ch07Ch07
Ch07
 

Ch04