A student writes an algorithm to calculate the perimeter of a rectangular garden using the width and the height.
If the perimeter is between 50 and 100 inclusive, "Standard Size" is output.
If the perimeter is not between 50 and 100 inclusive, "Custom Size" is output.
01 width = input("Enter width")
02 height = input("Enter height")
03 perimeter = width + width + height
04 if perimeter >= 50 then
05 print("Standard Size")
06 else
07 print("Custom Size")
08 endif
The algorithm does not work correctly.
Identify the line number of the two logic errors in the algorithm and write the corrected code for each line.
Practise OCR GCSE Computer Science Designing, creating and refining algorithms with exam-style questions for GCSE Computer Science. 50 questions, matched to the OCR GCSE Computer Science (J277) specification and written in Component 01 and Component 02 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.