Problem Solving and Program Design - Pseudocode 1 20240206 - Updated
Problem Solving and Program Design - Pseudocode 1 20240206 - Updated
Solving Presented by
Program
Design
Specific Objective
Define Define the term pseudo-code.
A Pseudo-code is an
PSEUDOCODE imitation computer
program
A pseusodo-code cannot
be executed in a high
level programming
language
PSEUDOCODE
cont…
is the intermediary
between an algorithm
and a high level
programming
language
Precise
Characteristics Unambiguous
of a
Pseudocode
Control flow from one process
to another
Terminate
Sequence
• Output
• Input
• Assignment
Selection / Conditional/Branching
DISPLAY
The general format “Expression”
of an output DISPLAY
“Expression”,
statement is: <variable_name>
OUTPUT
e.g. DISPLAY “Welcome to
Program Design”
STATEMENT
<variable_name> <value>
Example, Score 78
Created by: HR. Lawrence
Question: Write an algorithm to accept values in
ASSIGNMENT the variables p, m and n and calculate the
sum, product and average.
STATEMENTS
cont… Solution:
START
DISPLAY “Enter the first value”
INPUT p
DISPLAY “Enter the second value”
INPUT m
DISPLAY “Enter the third value”
INPUT n
Sum p + m + n
Product p * m * n
Average (sum / 3)
STOP
Write
Pseudocode
to: Accept and interchange values in the
variables a and b.
Write
pseudocode
that will: