1. CSC – 183
Programming C
Chapter - 5
7 October 2022 1
CSC-183
Decision Making and Branching
2. Simple if Statement :
• Format:
if ( test condition )
statements;
7 October 2022 CSC-183 2
3. Simple if Statement : (flowchart)
7 October 2022 CSC-183 3
Test
Expression
?
Statement-block
Statement - x
Next Statement
Entry
True
False
4. if_else Statement :
• Format:
if ( test condition )
statements;
else
statements;
7 October 2022 CSC-183 4
5. if_else Statement : (flowchart)
7 October 2022 CSC-183 5
Test
Expression
?
False-block
statement
Statement - x
Entry
True False
True-block
statement
6. nested if_else Statement
• When a series of decisions are involved, we may have to
use more than one if…else statement in nested form.
• Nested means one if statement inside of another if_else
statement.
• So, when one if statement appears inside of another if
statement for decision making is called nested if…else
• In nested if…else, nested if (inside one)may appear inside if
or else statement.
7 October 2022 CSC-183 6