Problem Analysis (Input, Process, Output)
Algorithm Design and Representation (Flowchart)
Control Structures (Sequence, Selection, Loop, Function)
❑ Purpose: To analyze the problem clearly, precisely and
completely.
❑ A few things to consider:
i. Input (Data needed)
ii. Process (Formula)
iii. Output (Information required)
• Sequential
One program statement follows SEQUENTIAL
another in sequence order.
• Selection
Represents a choice, offers two
or more paths to follow when
SELECTION
decisions must be made by a
program.
• Iteration / Repetition
Process may be repeated as long REPETITION
as certain condition remains true.
• Function
A program segment that can do
specific tasks.
Start
Display “Please enter the current year: “
Enter currentYear
Display “What year you were born?”
Enter bornYear
age = currentYear – bornYear
Display “You are “, age, “years old, now”
End
Start
Sequential:
Calculate a person’s Enter bornYear
Display “Please enter
age.
the current year: “
age = currentYear - bornYear
Enter currentYear
Display “You are “, age,
Display “What year you “years old, now”
were born? “
End
Start
Display “Please enter your mark: “
Enter studMark
IF studMark >= 60 THEN
Display “PASSED”
ENDIF
End
Selection:
Start
Reads a student’s mark
and prints “passed” if it
is greater than or equal Display “Please enter F studMark T
60. your mark: “ >= 60
Enter studMark
Display
“PASSED”
End
Start
number = 1, total = 0
WHILE (number <= 30)
Display “Please enter any number: “
Repetition: Enter anyNumber
Reads 30 numbers and
prints the average of total = total + anyNumber
the numbers entered number = number + 1
ENDWHILE
average = total / 30
Display “The average of 30 numbers: “, average
End
Start
number = 1, total = 0
F number T
<= 30
Repetition:
Display “Please enter
Reads 30 numbers and average = total / 30
any number: ”
prints the average of
the numbers entered
Display “The average Enter anyNumber
of 30 numbers: “,
average
total = total + anyNumber
End
number = number + 1