An algorithm is designed to count the number of warm and cold days recorded in a greenhouse. Temperatures of 18 degrees Celsius and above are classified as warm, while temperatures below 18 are classified as cold.
There are four errors in the pseudocode shown in Figure 1.
Figure 1
| Line | Pseudocode |
|---|---|
| 01 | |
| 02 | SET temps TO [18, 22, 14, 25, 12, 19, 15] |
| 03 | |
| 04 | SET warm TO 0 |
| 05 | SET cold TO 0 |
| 06 | SET index TO 0 |
| 07 | |
| 08 | WHILE NOT (index > LENGTH(temps)) DO |
| 09 | |
| 10 | IF temps[index] >= 18 THEN |
| 11 | SET warm TO temps[index] |
| 12 | ELSE |
| 13 | IF temps[index] < 18 THEN |
| 14 | SET cold TO cold + 1 |
| 15 | END IF |
| 16 | END IF |
| 17 | |
| 18 | SET index TO index + 1 |
| 19 | |
| 20 | END WHILE |
| 21 | |
| 22 | SEND "Cold days: " & cold TO DISPLAY |
| 23 | SEND "Warm days: " & warm TO DISPLAY |
Write the correct code for line 11.