Reference · Flowchart symbols for programming
Programming flowchart symbols: the shapes for drawing an algorithm
In short
Programming flowchart symbols are the shapes used to draw an algorithm before it is coded: an oval terminal for Start and End, a rectangle for a calculation or assignment, a parallelogram for input and output, a diamond for a condition, a hexagon for loop preparation, a double-sided rectangle for a subroutine call and arrows for the flow of control. With them every program is built from three structures: sequence, selection (if) and iteration (loops).
Updated · by the ChartCraft team · drawings rendered with Mermaid 11.17.2 · part of the flowchart symbols reference
What are the programming flowchart symbols?
Ten symbols are used in program flowcharts. ISO 5807 describes a program flowchart as process symbols for the operations, including the symbols that choose a path by a logical condition, and line symbols for the flow of control.
| Symbol | Name | In code | Mermaid |
|---|---|---|---|
| Terminal | The start and end of the program or function | A([Start]) | |
| Process | An assignment or calculation: total = total + mark | A[total = total + mark] | |
| Input/output | input(), print(), reading a file | A[/Read mark/] | |
| Decision | if, while or until condition with a true and a false exit | A{count > 0?} | |
| Flow line | The order statements run in | A[count = 0] --> B[/Read mark/] | |
| Preparation | Setting up a loop: for i = 1 to 10 | A{{i = 1 to 10}} | |
| Loop limit | Start (and a matching end) of a loop, used in pairs | A@{ shape: notch-pent, label: "For each mark" } | |
| Predefined process | Calling a function or procedure defined elsewhere | A[[average of marks]] | |
| Connector | Continues the flow at the circle with the same letter | A((A)) | |
| Annotation | A comment | A@{ shape: brace, label: "-1 ends the list" } |
Exam boards and textbooks differ on the extra symbols. Many courses accept only the first five plus the subroutine box; others teach the hexagon for for-loops. Use what your syllabus shows. Each basic symbol has its own page, for example the decision symbol and the loop symbol.
How are sequence, selection and iteration drawn?
Every algorithm is built from three structures. A sequence is boxes in a line. Selection is a diamond whose two branches join again. Iteration is a diamond with an arrow that goes back up.
| Structure | Drawing | Code | Read it out loud |
|---|---|---|---|
| Sequence | price = input()tax = price * 0.2print(price + tax) | Read the price, work out the tax, print the total. | |
| Selection (if-else) | if mark >= 50: print("Pass")else: print("Fail") | If the mark is at least 50, print Pass, otherwise print Fail, then carry on. | |
| Iteration, test first (while) | count = 1while count <= 3: print(count) count = count + 1 | While count is at most 3, print it and add one. When the test is false, leave the loop. | |
| Iteration, test last (repeat until) | repeat password = input()until valid(password) | Read a password, and keep reading until it is valid. The body always runs at least once. | |
| Subroutine call | marks = read_marks()avg = average(marks)print(avg) | Read the marks, call average, print the result. |
How do you turn an algorithm into a flowchart step by step?
Task: read exam marks until the user types -1, then print the average. Build it in three steps, testing each version with a few numbers.
Step 1
Write the straight sequence
Start, set the total and count to zero, read one mark, add it, print the average, end. This works for exactly one mark.
flowchart TD
S([Start]) --> I[total = 0, count = 0]
I --> R[/Read mark/]
R --> U[total = total + mark, count = count + 1]
U --> P[/"Print total / count"/]
P --> E([End])Step 2
Add the loop
After reading a mark, ask mark = -1? On No, add the mark and go back to read the next one. On Yes, leave the loop and print. The arrow goes back to the input, so each pass reads a new mark.
flowchart TD
S([Start]) --> I[total = 0, count = 0]
I --> R[/Read mark/]
R --> D{mark = -1?}
D -->|No| U[total = total + mark, count = count + 1]
U --> R
D -->|Yes| P[/"Print total / count"/]
P --> E([End])Step 3
Guard the division
Trace it with -1 as the first input: count is 0 and the program would divide by zero. Add a second decision before printing.
flowchart TD
S([Start]) --> I[total = 0, count = 0]
I --> R[/Read mark/]
R --> D{mark = -1?}
D -->|No| U[total = total + mark, count = count + 1]
U --> R
D -->|Yes| C{count > 0?}
C -->|Yes| P[/"Print total / count"/]
C -->|No| N[/Print No marks/]
P --> E([End])
N --> EDraw this in the editor → Opens ChartCraft with this description filled in: “Program flowchart that reads marks until -1 is entered, adds them up and counts them, then prints the average, or prints No marks if none were entered.”
How do you check a program flowchart with a trace table?
Follow the arrows with sample input and write down every variable each time it changes. If the last row matches the answer you worked out by hand, the flowchart is right for that input.
| Input | mark = -1? | total | count | Output |
|---|---|---|---|---|
| 0 | 0 | |||
| 60 | No | 60 | 1 | |
| 70 | No | 130 | 2 | |
| -1 | Yes | 130 | 2 | 65 |
Which programming flowchart mistakes lose marks?
Four mistakes cost the most marks in computing exams.
1. Input drawn in a process box
Loses marks
A[Read mark] --> B[total = total + mark]
Correct
A[/Read mark/] --> B[total = total + mark]
Reading and printing are input/output and go in a parallelogram. Rectangles are for calculations.
2. A decision with one exit
Loses marks
Correct
A condition is true or false, so a diamond always has two exits, each labelled.
3. The loop goes back to the wrong place
Loses marks
Correct
If the arrow returns to the decision, the same mark is tested forever. Return to the step that changes the condition: reading the next mark.
4. The loop resets its own variables
Loses marks
Correct
Initialisation (total = 0) belongs before the loop. Returning above it sets the total back to zero on every pass.
Can you answer these five programming flowchart questions?
Answer each one, then open the worked answer.
Question 1. Which symbol holds print("Hello")?
Worked answer
The parallelogram: printing is output.
Question 2. Which symbol holds x = x * 2?
Worked answer
The process rectangle: it is an assignment.
Question 3. How can you tell a while loop from a repeat-until loop on a flowchart?
Worked answer
In a while loop the diamond comes before the body, so the body may run zero times. In a repeat-until loop the diamond comes after the body, so it runs at least once.
Question 4. Which symbol signifies control passing between stages of an algorithm?
Worked answer
The flow line, an arrow. Across pages or far parts of one page, a connector with matching letters does the same job.
Question 5. Trace the finished marks flowchart with the input -1 only. What is printed?
Worked answer
The loop ends at once with count = 0. The second decision, count > 0?, is No, so it prints No marks instead of dividing by zero.
Questions
What are the programming flowchart symbols?
Terminal, process rectangle, input/output parallelogram, decision diamond, flow line, preparation hexagon, loop limit, predefined process (subroutine), connector and annotation.
What are the algorithm symbols in a flowchart?
The same shapes: an oval for start and end, a rectangle for each instruction, a parallelogram for input and output, and a diamond for each condition, joined by arrows.
What are the flowchart symbols in computer science?
The ISO 5807 program flowchart symbols. Courses usually require the terminal, process, input/output, decision and flow line, and often the subroutine box.
What are coding flow chart shapes?
Shapes that map to code: rectangles to assignments, parallelograms to input and print, diamonds to if and while conditions, and double-sided rectangles to function calls.
Which flowchart symbol is used to signify control passing between stages of an algorithm?
The flow line, an arrow. A connector circle continues the flow elsewhere on the page.
How do you draw a for loop in a flowchart?
Either with a preparation hexagon that holds the loop header, such as i = 1 to 10, or with an initialisation box, a decision and an increment box joined back to the decision.
Sources
The rules and names on this page were checked against these documents.
- ISO 5807:1985, Information processing, documentation symbols and conventions for data, program and system flowcharts. The standard that defines the program flowchart (process symbols, line symbols for the flow of control) and the names of the basic and special symbols. Read in the public preview.
- Mermaid documentation, Flowcharts. Node shapes, the @{ shape: ... } syntax added in Mermaid 11.3.0, subgraphs, labelled and dashed links.