Now that you know what an algorithm is, you need to be able to write one the way CSEC expects – as a flowchart or in pseudocode. This post covers the flowchart symbols, the pseudocode keywords, and the control structures: sequence, selection and loops (repetition).
Build on what you learned in Forms 1–3
These Lower School ICT posts cover the basics of this topic:
- Flowcharts – Representation – the flowchart symbols
- Flowcharts – Sequence – simple step-by-step flowcharts
- Flowcharts – Sequence, Selection Intro (Class Discussion) – making decisions in flowcharts
- Pseudocode, Looping, Revision – Live class (3NA 21-22) – loops in pseudocode
In this post:
- Flowchart symbols
- Pseudocode keywords
- Sequence
- Selection: IF-THEN, IF-THEN-ELSE and nested IF
- Loops: FOR, WHILE and REPEAT-UNTIL
Video: Computer Science Basics: Sequences, Selections, and Loops – https://www.youtube.com/watch?v=eSYeHlwDCNA
Flowchart symbols

Image source: File:LampFlowchart.svg
Pseudocode keywords
- Input:
READorINPUT - Output:
PRINT,WRITE,OUTPUTorDISPLAY - Storing a value (assignment):
STORE, or an arrow such astotal ← 0(some teachers use=) - Decisions:
IF … THEN … ELSE … ENDIF - Loops:
FOR … ENDFOR,WHILE … ENDWHILE,REPEAT … UNTIL
Sequence
In a sequence, the steps are carried out one after another, in order. Example: find the average of three test scores.
Pseudocode
START
READ score1, score2, score3
average ← (score1 + score2 + score3) / 3
PRINT "The average is ", average
STOP
Selection
Selection lets the algorithm make a decision and choose which steps to carry out.
IF-THEN-ELSE
START
READ mark
IF mark >= 50 THEN
PRINT "Pass"
ELSE
PRINT "Fail"
ENDIF
STOP
A nested IF is an IF inside another IF. It is used when there are more than two choices, such as grades:
Nested IF
READ mark
IF mark >= 75 THEN
PRINT "Grade A"
ELSE
IF mark >= 60 THEN
PRINT "Grade B"
ELSE
PRINT "Grade C"
ENDIF
ENDIF
Loops (repetition)
A loop repeats a set of steps. CSEC uses three kinds:
- FOR loop – repeats a known number of times (counter-controlled).
- WHILE loop – checks a condition first, and repeats while it is true. It may run zero times.
- REPEAT-UNTIL loop – does the steps first, then checks the condition at the end, so it always runs at least once.
FOR loop: add up 5 prices
total ← 0
FOR count ← 1 TO 5 DO
READ price
total ← total + price
ENDFOR
PRINT "Total: ", total
WHILE loop: keep going until -1 is entered (a sentinel or rogue value)
READ mark
WHILE mark <> -1 DO
IF mark >= 50 THEN
PRINT "Pass"
ELSE
PRINT "Fail"
ENDIF
READ mark
ENDWHILE
REPEAT-UNTIL loop: ask for the PIN until it is correct
REPEAT
READ pin
UNTIL pin = 1234
PRINT "Welcome"
Algorithm and program side by side
Here is a loop like the FOR example turned into real programs (the number of items is read first, and VAT is added as a constant). You will learn how to do this translation in Section 8.
Python
# Total a shopping bill and add VAT
VAT_RATE = 0.125 # constant: 12.5% VAT
num_items = int(input("How many items? "))
subtotal = 0.0
for i in range(num_items):
price = float(input("Enter price: $"))
subtotal = subtotal + price
vat = subtotal * VAT_RATE
total = subtotal + vat
print("Subtotal: $" + format(subtotal, ".2f"))
print("VAT: $" + format(vat, ".2f"))
print("Total: $" + format(total, ".2f"))
C
/* Total a shopping bill and add VAT */
#include <stdio.h>
#define VAT_RATE 0.125 /* constant: 12.5% VAT */
int main(void)
{
int num_items, i;
float price, subtotal = 0.0, vat, total;
printf("How many items? ");
scanf("%d", &num_items);
for (i = 1; i <= num_items; i++)
{
printf("Enter price: $");
scanf("%f", &price);
subtotal = subtotal + price;
}
vat = subtotal * VAT_RATE;
total = subtotal + vat;
printf("Subtotal: $%.2f\n", subtotal);
printf("VAT: $%.2f\n", vat);
printf("Total: $%.2f\n", total);
return 0;
}
Sample run: 3 items costing 25, 40.50 and 10 → Subtotal: $75.50, VAT: $9.44, Total: $84.94.
Try it: Flowchart symbol and control structure matcher
Choose the correct answer for each.
| Shape used for “Input price” | |
| Shape used for “total ← total + price” | |
| Shape used for “Is mark >= 50?” | |
| Shape used for “Start” and “Stop” | |
| Loop that repeats a known number of times | |
| Loop that always runs at least once | |
| Loop that checks its condition before running |
Related
Related:
• Ways of representing algorithms
• Closure on Sequence with flow charts
• Flowchart Practise – Finding the average of 3 numbers.
• Selection Statements: Practise Exercise(s)
• Using multiple selection statements (By Example)
Paper 1 practice (multiple choice)
Choose the best answer for each question. Try them all before you check.
1. Which flowchart symbol is used for a decision?
(A) Rectangle
(B) Parallelogram
(C) Diamond
(D) Oval
2. Which pseudocode keyword is used to accept data from the user?
(A) PRINT
(B) READ
(C) STORE
(D) ENDIF
3. Which loop is BEST when you know exactly how many times to repeat?
(A) WHILE
(B) REPEAT-UNTIL
(C) FOR
(D) IF-THEN
4. A REPEAT-UNTIL loop differs from a WHILE loop because it
(A) never ends
(B) checks the condition at the end, so it runs at least once
(C) cannot contain IF statements
(D) runs exactly 10 times
5. Carrying out instructions one after the other in order is called
(A) selection
(B) iteration
(C) sequence
(D) nesting
Show answers
1. C
2. B
3. C
4. B
5. C
Paper 2 practice (structured question)
A school canteen gives a 10% discount on any lunch order costing more than $50. Otherwise there is no discount.
(a) Name the flowchart symbol used for EACH of the following:
(i) reading the cost of the order (1 mark)
(ii) checking whether the cost is more than $50 (1 mark)
(b) Write pseudocode to read the cost of ONE order and print the amount to pay after any discount. (5 marks)
(c) State the type of loop you would use to process orders until a cost of 0 is entered, and give ONE reason. (2 marks)
(d) Distinguish between sequence and selection. (2 marks)
Total: 11 marks
Show answers
(a)
(i) Parallelogram / input-output symbol (1 mark)
(ii) Diamond / decision symbol (1 mark)
(b) One mark for each marked line:
READ cost (1 mark)
IF cost > 50 THEN (1 mark)
amount ← cost − (cost × 0.10) (1 mark)
ELSE
amount ← cost
ENDIF (1 mark for ELSE … ENDIF)
PRINT amount (1 mark)(c) WHILE (or REPEAT-UNTIL) loop (1 mark); the number of orders is not known in advance, so the loop must stop when the sentinel value 0 is entered (1 mark).
(d) Sequence: instructions are carried out one after another in order (1 mark). Selection: a condition is tested and a choice is made about which instructions to carry out (1 mark).
Next: Operators in Algorithms: Arithmetic, Relational and Logical Operators, Truth Tables, MOD and DIV
Syllabus link: This post is relevant to the CSEC® Information Technology Syllabus (CXC 30/G/SYLL 17), Section 7: Problem-Solving and Program Design, Specific Objective 6 (“represent algorithms in the form of flowchart and pseudocode”).
Attributions to media used in this post:
- LampFlowchart.svg – svg by Booyabazookaoriginal png by Wapcaplet – CC BY-SA 3.0 (via Wikimedia Commons)
Updates
2026/10/16
– Syntax highlighting added to code examples.
© 2026 Vedesh Kungebeharry. All rights reserved.






