0% found this document useful (0 votes)
21 views3 pages

Computer Science Error Notes FC

The document outlines errors in an algorithm intended to input 20 numbers and calculate their sum. Key errors include incorrect assignment operators, inconsistent variable casing, and improper loop syntax. The corrected algorithm adheres to IGCSE pseudocode standards, ensuring proper formatting and logic.

Uploaded by

st-sdube
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Computer Science Error Notes FC

The document outlines errors in an algorithm intended to input 20 numbers and calculate their sum. Key errors include incorrect assignment operators, inconsistent variable casing, and improper loop syntax. The corrected algorithm adheres to IGCSE pseudocode standards, ensuring proper formatting and logic.

Uploaded by

st-sdube
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

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!

You might also like