Chapter 7

Pseudocode and Flowcharts

Pseudocode and flowcharts are two ways to plan an algorithm clearly before writing real program code.

Planning an algorithm

An algorithm is a set of ordered steps that solves a problem. Before coding, designers write the algorithm as pseudocode (text that looks like a program but is not tied to one language) or draw a flowchart (a diagram of boxes and arrows). Both make logic easy to check and correct.

Pseudocode basics

Pseudocode uses keywords such as INPUT, OUTPUT, assignment with the arrow , and structures like IF … THEN … ELSE … ENDIF, FOR … NEXT and WHILE … ENDWHILE.

Example

INPUT Age
IF Age >= 18 THEN
  OUTPUT "Adult"
ELSE
  OUTPUT "Minor"
ENDIF

Flowchart symbols

A flowchart shows the same logic visually:

  • Terminator (rounded box) — start or stop
  • Parallelogram — input or output
  • Rectangle — a process or calculation
  • Diamond — a decision with Yes/No branches

Remember

  • Assignment uses , comparison uses =.
  • A decision diamond must have two exit paths.
  • Pseudocode has no fixed syntax, so keep it clear and consistent.

Stuck on this topic? A verified JomKelas tutor can walk you through it.

Find a verified tutor