2. Decision making is one of the most
important concept of computer
programming.
Program should be able to make
decision based on the condition.
Decision making is about deciding the
order of execution of statement based
on certain condition
3. There are THREE different types of
decision making control statements in c
language.
if statement
if…..else statement
nested if statement
4. DECISION CONTROL
STATEMENT(BRANCHING)
1. if statement
If statement is a powerful decision making
statement and is used to control the flow of
execution of statement.
If the condition evaluates to true, then the
respective block of code will be executed.
syntax:
if(condition)
{
Statement;
}
5. Flow chart of if control Entry
False
True
test
expressi
on
?
True
statement
7. 2. if…….else statement
Group of statements are executed when condition is
true.
If condition is false, then else part statements are
executed
Syntax:
if(condition)
{
Statement1;
Statement2;
}
else
{
Statement3;
Statement4;
}
8. The if…..else statement is used to carry out a
logical test and then take one of the two possible
actions, depending on the outcome of the test.
Flow chart of if..else control
Entry
True
False
test
expressi
on
?
True
statement
False
statement
10. Output
m and n are not equal
3.nested if
• if condition 1 is false, then condition 2 is checked and statements
are executed if it is true. If condition 2 also gets failure, then else
part is executed
if(condition-1)
{
Statement1;
}
else if (condition2)
{
Statement2;
}
else
{
Statement3;
}
13. Apart from the if statements, C language handles
decision making by supporting the following
statements
1.switch statement
2.Conditional operator statement
3.goto statement
1. switch statement
• Switch statement is used to solve multiple option
type problems.
• The expression is an integer expression or
characters.
• Each of the values should be unique with in a
switch statement
• Note that case labels end with a colon(:)
• When the switch statement is executed, the value
of the expression is compared against the values