// The cylinder program used previously can have output statements placed in the code to let the user know what the values of area and perimeter before surfarea is calculated and to show if the subprogram was executed.
REM the following program works out the surface area of a cylinder
DECLARE SUB circ (radius)
DIM SHARED area AS SINGLE
DIM SHARED perimeter AS SINGLE
DIM radius AS SINGLE
DO
INPUT "Please enter the radius of the cylinder"; radius
INPUT "Please enter the length of the cylinder"; length
CALL circ(radius)
PRINT "The area is "; area
PRINT "The perimeter is "; perimeter
surfarea = 2 * area + perimeter * length
PRINT "The surface area is "; surfarea
INPUT "Do you want to do again? (Y/N)"; again$
LOOP UNTIL UCASE$(again$) = "N"
END
SUB circ (radius)
area = 3.14 * radius * radius
perimeter = 2 * radius * 3.14
PRINT “subprogram executed”
END SUB