QBasic Programming

Display total surface area of cube

REM PROGRAM TO DISPLAY TOTAL SURFACE AREA OF CUBE
CLS
INPUT “ENTER SIDE OF A CUBE”; L
T= 6 * L ^ 2
PRINT “TOTAL SURFACE AREA OF CUBE“; T
END

USING SUB PROCEDURE

DECLARE SUB TSAREA (L)
CLS
INPUT “ENTER SIDE OF A CUBE”; L
CALL TSAREA(L)
END

SUB TSAREA (L)
T= 6 * L ^ 2
PRINT “TOTAL SURFACE AREA OF CUBE “; T
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION TSAREA (L)
CLS
INPUT “ENTER LENGTH”; L
PRINT “TOTAL SURFACE AREA OF CUBE”; TSAREA(L)
END

FUNCTION TSAREA (L)
TSAREA = 6 * L ^ 2
END FUNCTION

Display total surface area and volume of cuboid (Prev Lesson)
(Next Lesson) Display volume of cube
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!