P-Cubed wants to know the weight of the heaviest item and the weight of the lightest item - Edexcel - GCSE Computer Science - Question 8 - 2018 - Paper 1
Question 8
P-Cubed wants to know the weight of the heaviest item and the weight of the lightest item.
An operator enters weights for each item. The operator enters 0 when fini... show full transcript
Worked Solution & Example Answer:P-Cubed wants to know the weight of the heaviest item and the weight of the lightest item - Edexcel - GCSE Computer Science - Question 8 - 2018 - Paper 1
Step 1
Write an algorithm to meet the requirements.
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Initialize Variables
SET count TO 0
SET heaviest TO 0
SET lightest TO a very high number (e.g. 9999)
Start Input Loop
WHILE TRUE DO
PROMPT user for the weight ("Enter the weight for the item, 0 to quit:")