Writing a program with variables, constants, input and strings
A complete program declares variables and a CONSTANT, reads values with INPUT, processes them with assignments, then shows results with OUTPUT, using meaningful names and // comments.
Understanding Writing a program with variables, constants, input and strings in IGCSE Computer Science Paper 2
What it does: INPUT stores the value the user types in the variable HoursWorked, which must be declared first. An assignment with the ← operator stores the result of the arithmetic expression in the variable Wage. The variable being assigned goes on the left of ←, and the expression goes on the right. DIV gives the whole number of times 60 fits. MOD gives the remainder, which is the leftover seconds. MOD returns the remainder after division. For example, 135 MOD 60 is 15. In Cambridge pseudocode, the first character of a string is at position 1, not 0. Declare what you need, read values in, process them, then show the results.
Common mistakes: A constant is given its value with the assignment arrow, not =. It should be CONSTANT HourlyRate ← 12.5. WHOLE is not a Cambridge pseudocode data type. Whole numbers use INTEGER, so it should be DECLARE Seconds : INTEGER.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 347–357) and word search (Modules 337–357).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
DECLARE INPUT OUTPUTFill in the Blanks
Spot the Error
Student with a class code? Join your class →