Conditional Control Structure Chap - 04 - Class - 10
Conditional Control Structure Chap - 04 - Class - 10
STRUCTURE IN C
By Abbas Ghalib
CONTENTS
▪ Control Structure
▪ Control statement
▪ Conditional statement
▪ Structure of IF Statement
▪ Structure if IF-ELSE Statement
▪ Structure if ELSE-IF Statement
▪ SWITCH Statement
▪ Nested Selection Structure
CONTROL STRUCTURE
▪ In our daily life, we have to make different decisions.
▪ For example:
We will plan a trip to Muree tomorrow if there is snow fall tomorrow.
But what if there is no snow fall tomorrow????
May be, we have few other choices.
▪ In Computer Programming,
We come across many situations where we must make decisions
and perform operations depending upon the users input not the
program.
▪ Control structures are used to implement these decisions.
CONTROL STATEMENT
▪ An instruction that determines the sequence of execution of other
statements.
▪ It controls the flow of execution of program statements.
CONDITIONAL STATEMENT
▪ An instruction in Programming language that contains a condition.
▪ When a conditional statement is executed, first the condition is evaluated
and then based on the result (True / False), a particular statement or set of
statements is executed.
▪ C language has the following Conditional statements:
1. if
2. if-else
3. else-if
4. switch
Note:
Some programmers may prefer if-else rather than using conditional operator
because it is easy to understand.