AQA A-Level Computer Science · Section 4.1 Fundamentals of Programming
| Operator | Meaning | Example | Result |
|---|---|---|---|
| + | Addition | 17 + 5 | 22 |
| - | Subtraction | 17 - 5 | 12 |
| * | Multiplication | 17 * 5 | 85 |
| / | Real division | 17 / 5 | 3.4 |
| DIV | Integer division (quotient) | 17 DIV 5 | 3 |
| MOD | Modulo (remainder) | 17 MOD 5 | 2 |
| ^ | Exponentiation (power) | 2 ^ 8 | 256 |
Relational operators compare two values and return a Boolean (True/False).
| Operator | Meaning | Example | Result |
|---|---|---|---|
| = | Equal to | 5 = 5 | True |
| ≠ | Not equal to | 5 ≠ 3 | True |
| < | Less than | 3 < 7 | True |
| > | Greater than | 9 > 4 | True |
| ≤ | Less than or equal to | 5 ≤ 5 | True |
| ≥ | Greater than or equal to | 6 ≥ 9 | False |
| Variable | Value | Explanation |
|---|---|---|
| a | 3 | 15 DIV 4 = 3 (quotient) |
| b | 3 | 15 MOD 4 = 3 (15 = 3×4 + 3) |
| c | 3.75 | 15 / 4 = 3.75 (real division) |
| Operation | AQA Pseudocode | Python |
|---|---|---|
| Addition | a + b | a + b |
| Multiplication | a * b | a * b |
| Real division | a / b | a / b |
| Integer division | a DIV b | a // b |
| Modulo | a MOD b | a % b |
| Exponentiation | a ^ b | a ** b |
| Not equal to | a ≠ b | a != b |