Professional Documents
Culture Documents
Language Programming: Lesson 4: Flow Control
Language Programming: Lesson 4: Flow Control
Lesson 4:
Flow Control
Prepared by:
Prof. Marienel N. Velasco
Unit
Pg. 1
I’m going to talk about
• C If Statement
• C If…Else Statement
• C Switch…Case
Unit
Pg. 2
C If Statement
Syntax:
Unit
Pg. 3
C If Statement
How it works:
Unit
Pg. 4
C If Statement
Hands-on
Activity #1:
Program to
display a
number if
user enters
negative
number and if
positive, that
number won’t
be displayed)
Unit
Pg. 5
C If…Else Statement
Syntax:
Unit
Pg. 6
C If…Else Statement
How it works:
Unit
Pg. 7
C If…Else Statement
Hands-on
Activity #2:
Program to
check
whether an
integer is odd
or even
Unit
Pg. 8
C Switch Case Statement
Syntax:
Unit
Pg. 9
C Switch Case Statement
How it works:
UnitPg. 10
C Switch Case Statement
Hands-on
Activity #3:
Program to
create a
simple
calculator
Unit
Pg. 11
C Switch Case Statement
Hands-on
Activity #3:
(continuation)
Program to
create a
simple
calculator
Unit
Pg. 12
More Hands-on Exercises
Hands-on
Activity #4:
Program to
check even or
odd
Unit
Pg. 13
More Hands-on Exercises
Hands-on
Activity #5:
Program to
check vowel
or consonant
Unit
Pg. 14
More Hands-on Exercises
Hands-on
Activity #6:
Program to
find the largest
number
among three
numbers
UnitPg. 15
More Hands-on Exercises
Hands-on
Activity #7:
Program
to check
leap year
Unit
Pg. 16
More Hands-on Exercises
Hands-on
Activity #8:
Program to
check
alphabet
Unit
Pg. 17
That’s all folks!
Unit
Pg. 18