QBasic Programming

Display total surface area and volume of cylinder

REM PROGRAM TO DISPLAY TOTAL SURFACE AREA AND VOLUME OF CYLINDER
CLS
INPUT “ENTER RADIUS ”; R
INPUT “ENTER HEIGHT”; H
A= 2 * 3.14 * R * (R + H)
V = 3.14 * R ^ 2 * H
PRINT “TOTAL SURFACE AREA OF CYLINDER “; A
PRINT “VOLUME OF CYLINDER ”; V
END

USING SUB PROCEDURE

DECLARE SUB TSAREA (R, H)
DECLARE SUB VOLUME(R, H)
CLS
INPUT “ENTER RADIUS”; R
INPUT “ENTER HEIGHT”; H
CALL TSAREA(R, H)
CALL VOLUME(R, H)
END

SUB TSAREA (R, H)
A= 2 * 3.14 * R * (R + H)
PRINT “TOTAL SURFACE AREA OF CYLINDER “; A
END SUB

SUB VOLUME (R, H)
V = 3.14 * R ^ 2 * H
PRINT “VOLUME OF CYLINDER ”; V
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION TSAREA (R, H)
DECLARE FUNCTION VOLUME (R, H)
CLS
INPUT “ENTER RADIUS”; R
INPUT “ENTER HEIGHT”; H
PRINT “TOTAL SURFACE AREA OF CYLINDER ”; TSAREA(R, H)
PRINT “VOLUME OF CYLINDER ”; VOLUME(R, H)
END

FUNCTION TSAREA (R, H)
TSAREA = 2 * 3.14 * R * (R + H)
END FUNCTION

FUNCTION VOLUME (R, H)
VOLUME = 3.14 * R ^ 2 * H
END FUNCTION

Display volume of cylinder (Prev Lesson)
(Next Lesson) Display total surface area of cuboid / box
Back to QBasic Programming
Notice: compact(): Undefined variable: limits in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

Notice: compact(): Undefined variable: groupby in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!