Read the following subprogram written in pseudocode:
function processTemperatures(readings)
total = 0
count = 0
for temp in readings
if temp > 0 then
total = total + temp
count = count + 1
endif
endfor
if count > 0 then
result = total / count
return result
else
return -1
endif
endfunction
Describe the purpose of the processTemperatures subprogram.
33 exam-style questions on Edexcel IGCSE Computer Science Subprograms. Each one has a worked solution and a mark scheme showing where the marks go.