A QBASIC PROGRAM DISPLAY SURFACE AREA OF CYLINDER
Solution
Display the total surface area of the cylinder.
REM PROGRAM TO DISPLAY TOTAL SURFACE AREA OF CYLINDER
CLS
INPUT “ENTER RADIUS ”; R
INPUT “ENTER HEIGHT”; H
A= 2 * 3.14 * R * (R + H)
PRINT “TOTAL SURFACE AREA OF CYLINDER “; A
END
DISPLAY SURFACE AREA OF CYLINDER USING SUB PROCEDURE
DECLARE SUB TSAREA (R, H)
CLS
INPUT “ENTER RADIUS”; R
INPUT “ENTER HEIGHT”; H
CALL TSAREA(R, H)
END
SUB TSAREA (R, H)
A= 2 * 3.14 * R * (R + H)
PRINT “TOTAL SURFACE AREA OF CYLINDER “; A
END SUB
DISPLAY SURFACE AREA OF CYLINDER USING FUNCTION PROCEDURE
DECLARE FUNCTION TSAREA (R, H)
CLS
INPUT “ENTER RADIUS”; R
INPUT “ENTER HEIGHT”; H
PRINT “TOTAL SURFACE AREA OF CYLINDER”; TSAREA(R, H)
END
FUNCTION TSAREA (R, H)
TSAREA = 2 * 3.14 * R * (R + H)
END FUNCTION