QBasic Programming

Display total surface area and volume of hemisphere

REM PROGRAM TO DISPLAY TOTAL SURFACE AREA AND VOLUME OF HEMISPHERE.
CLS
INPUT “ENTER RADIUS ”; R
A= 3 * 3.14 * R ^ 2
V = (2 / 3) * 3.14 * R ^ 3
PRINT “TOTAL SURFACE AREA OF HEMISPHERE “; A
PRINT “VOLUME OF HEMISPHERE ”; V
END

USING SUB PROCEDURE

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

SUB TSAREA (R)
A= 3 * 3.14 * R ^ 2
PRINT “TOTAL SURFACE AREA OF HEMISPHERE “; A
END SUB

SUB VOLUME (R)
V = (2 / 3) * 3.14 * R ^ 3
PRINT “VOLUME OF HEMISPHERE ”; V
END SUB

USING FUNCTION PROCEDURE

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

FUNCTION TSAREA (R)
TSAREA = 3 * 3.14 * R ^ 2
END FUNCTION

FUNCTION VOLUME (R)
VOLUME = (2 / 3) * 3.14 * R ^ 3
END FUNCTION

Display volume of hemisphere (Prev Lesson)
(Next Lesson) Display total surface area of cylinder
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 !!