UNIHIVE

Study Hub UNIPORT CSC 183

CSC 183 · Introduction to Problem Solving

Flowcharts

Standard flowchart symbols and how to draw sequence, decision and loop structures.

Our notes

2 min read

What a flowchart is

A flowchart is a diagram of an algorithm using standard shapes joined by arrows that show the order of steps. It is good for seeing the overall flow, especially decisions and loops.

Standard symbols

SymbolShapeUse
Terminalrounded rectangle (oval)Start and Stop
Input/Outputparallelogramread data, print results
Processrectanglecalculations and assignments (Sum = Sum + X)
Decisiondiamonda yes/no question; two exits
Flow linearrowthe order of steps
Connectorsmall circlejoins parts of a chart on the same page
Off-page connectorpentagon (home plate)continues on another page
Predefined processrectangle with double sidesa sub-procedure described elsewhere

Three basic structures

  1. Sequence: one box after another.
  2. Selection (decision): a diamond with Yes and No paths that join again later.
  3. Repetition (loop): an arrow that goes back to an earlier point until a condition changes.

Any algorithm can be drawn with only these three (structured programming).

Worked example: pass or fail

Problem: read a score; print "Pass" if it is 40 or more, otherwise "Fail".

  1. Oval: Start.
  2. Parallelogram: Read SCORE.
  3. Diamond: SCORE ≥ 40?
  4. Yes → parallelogram: Print "Pass". No → parallelogram: Print "Fail".
  5. Both paths join → oval: Stop.

Trace: SCORE = 52 → Yes → "Pass". SCORE = 39 → No → "Fail". SCORE = 40 → Yes → "Pass" (the boundary case).

Worked example: sum of 1 to N

  1. Start. 2. Read N. 3. Set SUM = 0, I = 1.
  2. Decision: I ≤ N? No → go to step 7.
  3. Yes → SUM = SUM + I; I = I + 1.
  4. Arrow back to step 4.
  5. Print SUM. Stop.

Trace with N = 4: SUM becomes 1, 3, 6, 10; I becomes 5; 5 ≤ 4 is false; print 10. Check: 4 × 5 ÷ 2 = 10 ✓.

Rules for neat flowcharts

  • One Start and one Stop.
  • Flow from top to bottom, left to right.
  • Every decision has exactly two labelled exits.
  • Lines should not cross; use connectors.
  • Keep the wording short.

Advantages and limits

Easy to understand and to explain to non-programmers; good for spotting logic errors. But large flowcharts become messy and are hard to change, which is why pseudocode is often preferred for long algorithms.

Exams usually ask

  • Draw a flowchart for a given problem (largest of three numbers, sum or average, grading).
  • Name and draw the standard symbols.

Common mistake

Using a rectangle for a decision or forgetting to label the Yes and No exits.

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 183 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.