A quality control engineer writes an algorithm to determine whether a solid conical component is within acceptable manufacturing tolerances.
The volume of the cone, VVV, is calculated using its radius r r\,r and height hhh.
If the volume is strictly between 15 and 45, "Pass" is output.
Otherwise, "Fail" is output.
01 r = input("Enter radius")
02 h = input("Enter height")
03 V = (1/3) * 3.14159 * r * h
04 if V > 15 then
05 print("Pass")
06 else
07 print("Fail")
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.