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.
41 exam-style questions on OCR GCSE Computer Science Designing, creating and refining algorithms. Each one has a worked solution and a mark scheme showing where the marks go.