The Problem Solving Process & Algorithms
The Problem Solving Process & Algorithms
Algorithms
Mr Allen
Immaculate Conception High School
Objectives
By the end of the lesson students should be
able to:
num1 0
num2 0
sum 0
STOP
Narratives
This representation of an algorithm is the closest
in nature to English. You will simply need to state
the main steps to solve your problem in English
statements. In simpler terms a narrative is a
summary of the steps of a program. A narrative
should be void of technical terms, its main purpose
is to explain an algorithm to stake holders such as a
client.
Example
Pseudocode Narrative
Algorithm: Sum of Two Numbers Algorithm: Sum of Two Numbers
Developer: Developer:
Date: Date:
START
Declare variables num1, num2 and START
sum AS INTEGER Step 1: Prompt user to enter two numbers
Step 2: Accept the two numbers and store
num1 num2 sum 0 them
Print “Enter two numbers” Step 3: Add the two numbers
Step 4: Display the sum of the two numbers.
Read num1, num2.
sum num1 + num2 STOP
Print sum
STOP
Flow Charts
A flowchart is a type of diagram that represents
an algorithm or process, showing the steps as boxes
of various kinds, and their order by connecting them
with arrows.
Flow Chart Symbols
Other Flow Chart Symbols
START
Flow Chart Example WRITE “Please type your full name including middle name:”
READ Bet
READ Bet
WRITE “"Total Winnings: JA$", Total_win
A
(LET) Amt_won <-- (Bet * Bet) / ( (Bet * Bet) - ( 100 * Bet ) )* 25000
STOP