You're asking for the errors in this algorithm:
---
### ❌ **Original Algorithm (line-by-line):**
```
Sum = 0
FOR count = 1 to 20
INPUT 'Enter number ', Number
SUM = Sum + Number
count = count + 1
PRINT sum
Next
```
---
### ✅ **Goal:**
To **input 20 numbers**, calculate their **total (sum)**, and **output** the result.
---
## 🔍 **Line-by-Line Error Analysis & Highlights:**
| Line | Original Code | ❌ Error | ✅ Correction | 💬 Explanation
|
| ---- | ------------------------------- | ------------------------------- | ------------------------------ |
------------------------------------------------------------------------------------------------------------------ |
| 1 | `Sum = 0` | ❌ Use of `=` instead of `←` | `Sum ← 0` | In IGCSE
pseudocode, `←` is used for assignment. |
| 2 | `FOR count = 1 to 20` | ❌ Use of `=` and lowercase `to` | `FOR count ← 1 TO 20` |
IGCSE syntax requires `←` and `TO` in capital letters. |
| 3 | `INPUT 'Enter number ', Number` | ❌ Single quotes & format | `INPUT "Enter number",
Number` | Strings should be in **double quotes**, and this is the correct input format.
|
| 4 | `SUM = Sum + Number` | ❌ Inconsistent variable casing | `Sum ← Sum + Number`
| Variables should have consistent casing (`Sum`, not `SUM`). Also use `←`. |
| 5 | `count = count + 1` | ❌ Logical error | ❌ **REMOVE this line** | The
`FOR` loop automatically increments `count`, so this line will **break the loop** or cause it to skip
numbers. |
| 6 | `PRINT sum` | ❌ Indentation / placement | Move **after** `Next` | You
should **only print once**, after all inputs are added. |
| 7 | `Next` | ❌ Capitalisation | `NEXT` | Keywords like `NEXT`
should be in uppercase for IGCSE. |
---
### ✅ **Corrected Algorithm:**
```
Sum ← 0
FOR count ← 1 TO 20
INPUT "Enter number", Number
Sum ← Sum + Number
NEXT
PRINT Sum
```
---
### 🧠 **Summary of Errors:**
1. ❌ **Incorrect assignment operator** (`=` instead of `←`)
2. ❌ **Incorrect FOR loop syntax** (`=` and lowercase `to`)
3. ❌ **Wrong input format** (uses single quotes)
4. ❌ **Inconsistent variable casing** (`SUM`, `Sum`, `sum`)
5. ❌ **Manual increment inside FOR loop** (causes logic error)
6. ❌ **PRINT inside the loop** (should be after `NEXT`)
7. ❌ **Incorrect capitalisation of `Next` keyword**
---
Let me know if you want this formatted as an exam-style question or diagrammed with comments!