GCSE Revision Aid: This resource is designed to support your revision and may contain errors. If you find a discrepancy with your class teaching, your teacher is correct — please let us know at gcserevise@scott.scottrix.co.uk.

CS8: Arithmetic and Relational Operations

Foundation Higher AQAEdexcelOCREduqasCCEA

Master arithmetic operators including DIV and MOD, relational operators for comparison, and the order of operations in pseudo-code.

Fastmail

➕ Arithmetic Operators

Arithmetic operators perform mathematical calculations on numeric values. At GCSE, you need to know seven operators including DIV and MOD.
Operator Symbol Description Example Result
Addition + Add two values 5 + 3 8
Subtraction - Subtract second from first 10 - 4 6
Multiplication * Multiply two values 6 * 7 42
Real division / Divide, returns decimal 7 / 2 3.5
Integer division DIV Divide, returns whole number only 7 DIV 2 3
Modulo (remainder) MOD Returns the remainder after division 7 MOD 2 1
Exponent ^ Raises to a power 2 ^ 3 8

🔢 DIV and MOD in Detail

DIV gives the whole number result of division (quotient). MOD gives the remainder. Together they describe any division completely: for a / b, the quotient is a DIV b and the remainder is a MOD b.
The Division Relationship:
dividend = divisor * quotient + remainder
a = b * (a DIV b) + (a MOD b)

Example: 17 / 5
17 DIV 5 = 3 (the quotient)
17 MOD 5 = 2 (the remainder)
Check: 5 * 3 + 2 = 17 ✓
DIV and MOD Worked Examples
ExpressionResultExplanation
10 DIV 3310 / 3 = 3.33..., whole number part = 3
10 MOD 31Remainder when 10 is divided by 3
20 DIV 4520 / 4 = 5 exactly, no remainder
20 MOD 40No remainder
15 DIV 4315 / 4 = 3.75, whole number part = 3
15 MOD 43Remainder = 15 - (4 * 3) = 15 - 12 = 3

Common Uses of MOD

Using MOD to Check Even/Odd
INPUT number
IF number MOD 2 = 0 THEN
    OUTPUT number, " is even"
ELSE
    OUTPUT number, " is odd"
ENDIF

⚖️ Relational Operators

Relational operators compare two values and return a Boolean result (TRUE or FALSE). They are used in IF conditions and WHILE loop conditions.
Operator Symbol Meaning Example Result
Equal to = Both values are the same 5 = 5 TRUE
Not equal to <> Values are different 5 <> 3 TRUE
Less than < First value is smaller 3 < 5 TRUE
Greater than > First value is larger 7 > 4 TRUE
Less than or equal to <= First value is smaller or equal 5 <= 5 TRUE
Greater than or equal to >= First value is larger or equal 6 >= 3 TRUE
Exam Warning: In pseudo-code, = means "equal to" (comparison), NOT assignment. Assignment uses the left-arrow (←). This is different from languages like Python where = is assignment and == is comparison.
Relational Operators in Conditions
IF age >= 18 THEN
    OUTPUT "Adult"
ENDIF

WHILE attempts < 3
    INPUT "Try again: ", guess
    attempts ← attempts + 1
ENDWHILE

IF password = "secret" THEN
    OUTPUT "Access granted"
ENDIF

📐 Order of Operations

BODMAS/BIAS applies in programming just as in maths. Operations are evaluated in a specific order: Brackets first, then exponents, then division/multiplication, then addition/subtraction.
Operator Precedence (highest to lowest):
1. Brackets () - always evaluated first
2. Exponentiation ^
3. Division /, DIV, MOD and Multiplication *
4. Addition + and Subtraction -
5. Relational operators (=, <>, <, >, <=, >=)
6. Boolean operators (NOT, AND, OR)

When operators have the same precedence, evaluate left to right.
Order of Operations Examples
3 + 4 * 2       = 3 + 8 = 11    (multiplication before addition)
(3 + 4) * 2     = 7 * 2 = 14    (brackets first)
10 - 3 - 2      = 7 - 2 = 5     (left to right)
2 ^ 3 ^ 2       = 8 ^ 2 = 64    (left to right for exponents)
10 DIV 3 + 1    = 3 + 1 = 4     (DIV before addition)
10 + 3 MOD 2    = 10 + 1 = 11   (MOD before addition)
Complex Expression
result ← 2 + 3 * 4 ^ 2 - 1

Step 1: 4 ^ 2 = 16

Step 2: 3 * 16 = 48

Step 3: 2 + 48 = 50

Step 4: 50 - 1 = 49

result = 49

⚠️ Common Mistakes

Mistake Why It's Wrong How to Fix It
Confusing / and DIV / returns a decimal, DIV returns an integer Use / for real results, DIV for whole number results
Using = for assignment In pseudo-code = means "equal to" Use ← for assignment
Forgetting brackets Average of 3+4+5 is not 3+4+5/3 Use (3+4+5)/3 = 4, not 3+4+5/3 = 8.67
MOD with negative numbers Different languages handle this differently At GCSE, assume positive numbers only
Wrong order of operations 2+3*4 = 14, not 20 Use brackets to make your intention clear

❓ Practice Questions

Q1: Evaluate: 17 DIV 5 and 17 MOD 5

Q2: Write pseudo-code that checks if a number is divisible by 3.

Q3: Evaluate step by step: 3 + 4 * 2 - 1

Q4: Write pseudo-code that takes a number of minutes and outputs the hours and remaining minutes.

Q5: What is the result of (10 + 5) / 3? What about 10 + 5 / 3?

✅ Answers

  1. 17 DIV 5 = 3 (17 / 5 = 3.4, whole number part = 3). 17 MOD 5 = 2 (remainder = 17 - 5*3 = 2).
  2. INPUT number
    IF number MOD 3 = 0 THEN
        OUTPUT number, " is divisible by 3"
    ELSE
        OUTPUT number, " is not divisible by 3"
    ENDIF
  3. Step 1: 4 * 2 = 8. Step 2: 3 + 8 = 11. Step 3: 11 - 1 = 10.
  4. INPUT totalMinutes
    hours ← totalMinutes DIV 60
    minutes ← totalMinutes MOD 60
    OUTPUT hours, " hours and ", minutes, " minutes"
  5. (10 + 5) / 3 = 15 / 3 = 5.0. 10 + 5 / 3 = 10 + 1.67 = 11.67. Brackets change the result!

🎯 Exam Tips

⚠️ Common Errors

✗ Confusing = (assignment) with == (comparison) ✓ A single = assigns a value to a variable; == compares two values for equality. In pseudo-code, ← is assignment and = is comparison.

✗ Forgetting operator precedence — assuming left-to-right evaluation always applies ✓ BODMAS/BIDMAS rules apply: brackets first, then multiplication/division, then addition/subtraction. Use brackets to make order explicit.

✗ Using DIV when MOD is needed (or vice versa) ✓ DIV gives the integer quotient (7 DIV 2 = 3); MOD gives the remainder (7 MOD 2 = 1). MOD is used to check divisibility (e.g. n MOD 2 = 0 means n is even).

✗ Confusing <> (not equal) with < (less than) or > (greater than) ✓ In pseudo-code, <> means 'not equal to'. < means 'less than' and > means 'greater than'. These are different relational operators.

✍️ Model Answer

Full-Mark Response

Write pseudo-code that inputs a number and determines whether it is divisible by both 3 and 5, divisible by 3 only, divisible by 5 only, or neither. Output an appropriate message for each case. [4 marks]

INPUT number IF number MOD 3 = 0 AND number MOD 5 = 0 THEN OUTPUT 'Divisible by both 3 and 5' ELSE IF number MOD 3 = 0 THEN OUTPUT 'Divisible by 3 only' ELSE IF number MOD 5 = 0 THEN OUTPUT 'Divisible by 5 only' ELSE OUTPUT 'Not divisible by 3 or 5' ENDIF

📊 AO Deep Dive

Assessment Objective Analysis

AO1 (Computational Thinking — 40%): Demonstrate knowledge and understanding of the principles and concepts of computer science, including arithmetic and relational operators: DIV and MOD for AQA 8525, OCR J277 & Edexcel 1CP2.

AO2 (Application — 40%): Apply knowledge and understanding of computer science, including arithmetic and relational operators: DIV and MOD to analyse problems in computational terms and to design, write and evaluate solutions.

AO3 (Evaluation — 20%): Evaluate the effectiveness, correctness and efficiency of computational solutions, including arithmetic and relational operators: DIV and MOD, and make reasoned judgements about trade-offs.

📝 Exam Technique

GCSE Computer Science Exam Tips:
Know your operators: +, -, *, /, DIV, MOD, ^ for arithmetic; =, <>, <, >, <=, >= for comparison; AND, OR, NOT for logic. MOD is essential for divisibility checks and wrapping values. DIV for integer division. Always use brackets to clarify order of operations. In pseudo-code, ← is assignment; = is equality comparison. Remember BODMAS applies in expressions.

📝 Exam Questions by Topic

🎬 Video Resources

Share this page

Ready to ace your GCSE Computer Science exams?

Get the best revision books and guides to boost your grades.