A computer science student has written a block of pseudocode to find the minimum atmospheric pressure recorded during a weather balloon flight from an array of 6 sensor readings.
1 pressures = [1013, 998, 985, 1002, 991, 1007]
2 lowest = pressures
3 idx = 1
4 WHILE idx <= 6
5 IF pressures[idx] < lowest THEN
6 pressures[idx] = lowest
7 ENDIF
8 idx = idx + 1
9 ENDWHILE
10 OUTPUT "Lowest pressure: " + lowest
Line 4 and Line 6 contain errors.
Identify the error in each line and construct new lines of pseudocode that will correct the errors.
| Line Number | Error | Correction |
|---|---|---|
| Line 4 | ||
| Line 6 |