Answer:
Option d lnterchanging line 7 and line 8
Step-by-step explanation:
This program is expected to calculate the average of all the elements in a list. This is not necessary to include the step average <- sum/count in the for loop. We only need to calculate the average after we get the final sum and count. We don't need to repeatedly calculate the average using the sub-total and current count number. We will only the the final sum and count after completion of the for loop and therefore the step should be placed outside the loop and this can reduce number of calculation operation but produce the same output. The modified program logic is as follows:
Line 1: count ← 0
Line 2: sum ← 0
Line 3: FOR EACH value IN numbers
Line 4: {
Line 5: count ← count + 1
Line 6: sum ← sum + value
Line 7: }
Line 8: average ← sum / count
Line 9: DISPLAY (average)