UNIHIVE

Study Hub UNIPORT CSC 280

CSC 280 · Introduction to Computer Programming

Flowcharts and pseudocode

Standard flowchart symbols, drawing flowcharts for sequence, decisions and loops, and writing clear pseudocode.

Our notes

2 min read

Flowchart symbols

SymbolShapeUse
Terminaloval (rounded rectangle)Start and Stop
Input/OutputparallelogramRead, Print
Processrectanglecalculations, assignments
Decisiondiamonda yes/no question, two exits
Flow linearroworder of steps
Connectorsmall circlejoins parts of a chart (same page)
Off-page connectorpentagon (home plate)continues on another page
Predefined processrectangle with double side linesa subroutine

Rules for flowcharts

  • One Start and one Stop.
  • Flow goes top to bottom, left to right.
  • A decision box has exactly two exits (Yes and No) and they must be labelled.
  • Lines should not cross; use connectors if needed.

Flowchart in words: largest of three numbers

Start → Read A, B, C → Decision "A > B?"

  • Yes → Decision "A > C?": Yes → Print A; No → Print C.
  • No → Decision "B > C?": Yes → Print B; No → Print C.

All paths → Stop.

Loop in a flowchart

A loop is a decision whose exit arrow goes back up to an earlier box. Example: sum of numbers 1 to N: Start → Read N → SUM = 0, I = 1 → Decision "I ≤ N?" — Yes → SUM = SUM + I → I = I + 1 → back to the decision; No → Print SUM → Stop.

Pseudocode

Pseudocode is structured English halfway between an algorithm and real code. It has no fixed syntax but uses clear keywords: READ, PRINT, IF … THEN … ELSE … ENDIF, WHILE … ENDWHILE, FOR … TO … ENDFOR, and indentation.

Example: grade from a score.
READ score
IF score >= 70 THEN grade ← "A"
ELSE IF score >= 60 THEN grade ← "B"
ELSE IF score >= 50 THEN grade ← "C"
ELSE IF score >= 45 THEN grade ← "D"
ELSE IF score >= 40 THEN grade ← "E"
ELSE grade ← "F"
ENDIF
PRINT grade
(This is the usual 5-point scale used at UNIPORT and many Nigerian universities.)

Example: factorial of N.
READ N
fact ← 1
FOR i ← 1 TO N
    fact ← fact × i
ENDFOR
PRINT fact
Trace for N = 5: 1, 2, 6, 24, 120.

Flowchart or pseudocode?

FlowchartPseudocode
visual, easy to follow for small programsquick to write and change
hard to draw and edit for big programscloser to real code
good for showing branchesgood for long or nested logic

Exams usually ask: name and draw the symbols; draw a flowchart for a given problem (largest number, sum/average, even or odd, quadratic roots, grades); write pseudocode; trace a flowchart and give its output.

Common mistake: using a rectangle for input and output. Read and Print go in a parallelogram.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All CSC 280 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.