Arithmetic operations
Arithmetic Operations in Programs
Programs regularly perform calculations on numeric values. AQA requires you to use five arithmetic operations: addition, subtraction, multiplication, real division, and integer division including remainders. The first three work exactly as you would expect; the two forms of division need careful attention because they produce very different results.
| Operation | AQA pseudocode | Python | VB.NET | C# | Example result |
|---|---|---|---|---|---|
| Addition | a + b |
a + b |
a + b |
a + b |
7 + 3 = 10 |
| Subtraction | a - b |
a - b |
a - b |
a - b |
7 - 3 = 4 |
| Multiplication | a * b |
a * b |
a * b |
a * b |
7 * 3 = 21 |
| Real division | a / b |
a / b |
a / b |
(double)a / b |
7 / 2 = 3.5 |
| Integer division | a DIV b |
a // b |
a b |
a / b (integers) |
7 DIV 2 = 3 |
| Remainder (MOD) | a MOD b |
a % b |
a Mod b |
a % b |
7 MOD 2 = 1 |
Real Division vs Integer Division
This is the most important distinction in this benchmark. Real division produces a decimal result. Integer division discards the decimal part and returns only the whole-number quotient. The remainder (MOD) gives what is left over. AQA describes integer division as a two-stage process using modular arithmetic.
Real division returns a decimal (real) result. Use it whenever you need the exact value including the fractional part - for example, calculating an average mark.
# Python — real division always uses /
total = 11
count = 2
average = total / count # result: 5.5 (decimal preserved)
print(average) # 5.5
Integer division returns only the whole-number part of the result - the decimal is discarded entirely. The remainder (MOD) gives the leftover value. Together they describe the result completely: 11 = (2 × 5) + 1.
# Python — integer division (//) and remainder (%)
value = 11
divisor = 2
quotient = value // divisor # AQA: DIV result: 5 (decimal discarded)
remainder = value % divisor # AQA: MOD result: 1 (what is left over)
print(quotient) # 5
print(remainder) # 1
# Check: (divisor * quotient) + remainder == value
# (2 * 5) + 1 = 11 ✓
MOD has many real-world uses. A common one is checking whether a number is odd or even: any number MOD 2 returns 0 if even or 1 if odd. Another is wrapping a counter back to zero - for example, cycling through positions 0, 1, 2, 0, 1, 2, ... using position MOD 3.
# Python — practical uses of MOD
number = 14
if number % 2 == 0:
print(number, "is even")
else:
print(number, "is odd")
# Wrapping counter: cycles 0 -> 1 -> 2 -> 0 -> 1 -> 2 ...
for i in range(7):
print(i % 3, end=" ") # output: 0 1 2 0 1 2 0
Key Takeaways
- Real division (/) preserves the decimal part of the result. Integer division (DIV / //) discards it, returning only the whole-number quotient.
- MOD returns the remainder after integer division. Together, DIV and MOD fully describe the result: value = (divisor × quotient) + remainder.
- In Python,
/always gives a real result;//gives the integer quotient;%gives the remainder. - In C#, dividing two integers with
/performs integer division automatically. Use a cast (e.g.(double)a / b) to get a real result. - MOD is widely used in programs: checking odd/even, wrapping counters, and converting between units (e.g. minutes to hours and remaining minutes).