← IGCSE Computer Science Paper 2

ROUND: rounding to decimal places

Library routine that returns value rounded to the given number of decimal places. ROUND(3.14159, 2) gives 3.14. If places is 0, the result is a whole number.

Understanding ROUND: rounding to decimal places in IGCSE Computer Science Paper 2

What it does: Price is an identifier that holds a REAL value, and ROUND rounds that value to 1 decimal place. Total / 3 is calculated first, then the result is rounded to 2 decimal places and output. The 2 means 2 decimal places. The next digit is 1, so 3.14159 rounds down to 3.14. The second argument is the number of decimal places. ROUND(7.8261, 3) returns 7.826. Places of 0 gives a whole number. 8.67 rounds up to 9. The third decimal digit is 1, so the second decimal place stays the same. The result is 4.56. ROUND(value, places) always takes two arguments, so leaving out places is an error.

Common mistakes: The arguments of ROUND must be separated by a comma, not a semicolon. It should be ROUND(3.14159, 2). ROUND needs two arguments: the value and the number of decimal places. It should be ROUND(Mark, 2).

Class: _____________________  ·  Name: _____________________  ·  Date: _________

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 429–438) and word search (Modules 419–438).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What does ROUND(3.14159, 2) return?
3.143.15
Matches
Answer ← ROUND(8.567)
↓
The places argument is missing. ROUND needs two arguments: the value and the number of decimal places, e.g. ROUND(8.567, 2).
Applying
Meanings
Term
ROUND(value, places)
Meaning
Library routine that returns value rounded to the given number of decimal places. ROUND(3.14159, 2) gives 3.14. If places is 0, the result is a whole number.
Practice
Price ← 3.14159
Testing
Gaps
OUTPUT (3.14159, 2)
Check Answer
Spots
1Result ← ROUND(3.14159; 2)
2OUTPUT Result

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Viperfish' badge — Deep Debugger, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What does ROUND(3.14159, 2) return?
A. 3.14 ✓
B. 3.15
The 2 means 2 decimal places. The next digit is 1, so 3.14159 rounds down to 3.14.
2. In ROUND(7.8261, 3), what does the second value, 3, tell the routine?
A. How many times to repeat the rounding
B. How many decimal places to round to ✓
The second argument is the number of decimal places. ROUND(7.8261, 3) returns 7.826.
3. What does ROUND(8.67, 0) return?
A. 9 ✓
B. 8.7
Places of 0 gives a whole number. 8.67 rounds up to 9.
4. Which call rounds the REAL variable Price to 1 decimal place?
A. ROUND(Price, 1) ✓
B. ROUND(1, Price)
The value goes first and the number of places goes second: ROUND(value, places).
5. Which is a valid use of ROUND with an expression as the value?
A. Total ← ROUND(Cost * 1.2)
B. Total ← ROUND(Cost * 1.2, 2) ✓
The value can be an expression, but ROUND still needs the places argument. Cost * 1.2 is worked out first, then rounded.

Match the Pairs

ROUND(3.14159, 2) → Returns 3.14, the value rounded to 2 decimal places
ROUND(7.6, 0) → Returns 8, a whole number, because places is 0
The value given to ROUND can be an identifier holding a REAL number → Result ← ROUND(Price, 1)
The value given to ROUND can be an expression, which is worked out first and then rounded → OUTPUT ROUND(Total / 3, 2)
Answer ← ROUND(8.567) → The places argument is missing. ROUND needs two arguments: the value and the number of decimal places, e.g. ROUND(8.567, 2).
Answer ← ROUND(2, 8.567) → The arguments are in the wrong order. The value comes first and the INTEGER places comes second, so it should be ROUND(8.567, 2).

Key Term

ROUND(value, places)
Library routine that returns value rounded to the given number of decimal places. ROUND(3.14159, 2) gives 3.14. If places is 0, the result is a whole number.

Fill in the Blanks

1. OUTPUT ROUND(3.14159, 2)
Hint: Type the library routine name that rounds a value to a number of decimal places.
2. OUTPUT ROUND(3.14159, 2)
Hint: Type the places argument that makes the result show two decimal places.
3. Total ← 7.6 Whole ← ROUND(Total, 0)
Hint: Type the places value that makes ROUND return a whole number.
4. Average ← ROUND(Total / Count, 1)
Hint: Type the expression that divides one variable by the other, so its result is the value to be rounded.
5. Area ← 3.14159 * Radius * Radius OUTPUT ROUND(Area, 2)
Hint: Type the identifier of the variable that holds the REAL value to be rounded.

Spot the Error

Question 1
A Result ← ROUND(3.14159; 2)
B OUTPUT Result
C OUTPUT ROUND(Result, 1)
Line A — The arguments of ROUND must be separated by a comma, not a semicolon. It should be ROUND(3.14159, 2).
Question 2
A DECLARE Mark : REAL
B Mark ← 7.6543
C Mark ← ROUND(Mark)
D OUTPUT Mark
Line C — ROUND needs two arguments: the value and the number of decimal places. It should be ROUND(Mark, 2).
Question 3
A DECLARE Total : REAL
B Total ← 12.3456
C Rounded ← ROUND(2, Total)
D OUTPUT Rounded
Line C — The arguments are in the wrong order. The value comes first and the places second, so it should be ROUND(Total, 2).
Question 4
A INPUT Cost
B Cost ← ROUND(Cost * 1.2, 2
C OUTPUT Cost
Line B — The closing bracket is missing. The call must end with ), so it should be ROUND(Cost * 1.2, 2).
Question 5
A DECLARE Avg : REAL
B DECLARE Total : INTEGER
C Total ← 25
D Avg ← ROUND(Total / 3, 1.5)
E OUTPUT Avg
Line D — The places argument must be an INTEGER because it counts decimal places. 1.5 is a REAL, so it should be ROUND(Total / 3, 1).

Student with a class code? Join your class →