Lecture 5
Lecture 5
Programming
Lecture 5
By: Dr. Raja Kamil
Learning Outcome
vUnderstanding and apply conditional statement
switch…case
Recall Quiz
Generate or construct pseudocode, flowchart and codes for the
output below. Use if…else to decide which value is the smallest
and largest
A Solution
Quiz
Consider the following pseudocode, then generate a flowchart and
code.
x is the variable
containing the value
being considered
Case2
switch vs if
if switch
float Yes No
Relational operator Yes No
e.g. ‘=>‘
executed
Quiz: Generate the following
3+2=5
3–2=1
3*2=6
3 / 2 =1.5
Quiz: Determine the output
Floating-point as an expression is
not allowed in the switch case
Quiz: Determine the printout with ID
500 and password 000