Computer Science, asked by naniupadhyaya, 8 months ago

Write a program in qbasic to calculate the volume of the sphere using SUB procedure. Please give the answer only if you know.​

Answers

Answered by SainiEknoor
1

Answer:

not sure

Explanation:

1) FIND THE VOLUME OF CYLINDER AND HEMISPHERE .

 

   DECLARE SUB VOC (R,H)

   DECLARE SUB VOH (R)

   CLS

   INPUT " ENTER RADIUS " ; R

   INPUT " ENTER HEIGHT " ; H

   CALL  VOC (R,H)

   CALL VOH (R)

   END

   SUB VOC (R,H)

   C= ( 22 / 7 ) * R^2 * H

   PRINT " VOLUME OF CYLINDER = " ; C

   END SUB

    

   SUB VOH (R)

   H = (2/3) * (22/7) *R^3

   PRINT "VOLUME OF HEMISPHERE = " ; H

   END SUB

Answered by ritayadav0110
2

Answer:

REM PROGRAM TO DISPLAY TOTAL SURFACE AREA OF SPHERE.

CLS

INPUT “ENTER RADIUS ”; R

A= 4 * 3.14 * R ^ 2

PRINT “TOTAL SURFACE AREA OF SPHERE “; A

END

USING SUB PROCEDURE

DECLARE SUB TSAREA (R)

CLS

INPUT “ENTER RADIUS”; R

CALL TSAREA(R)

END

SUB TSAREA (R)

A= 4 * 3.14 * R ^ 2

PRINT “TOTAL SURFACE AREA OF SPHERE “; A

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION TSAREA (R)

CLS

INPUT “ENTER RADIUS”; R

PRINT “TOTAL SURFACE AREA OF SPHERE ”; TSAREA(R)

END

FUNCTION TSAREA (R)

TSAREA = 4 * 3.14 * R ^ 2

END FUNCTION

29. Display volume of sphere.

REM PROGRAM TO DISPLAY VOLUME OF SPHERE.

CLS

INPUT “ENTER RADIUS ”; R

V = (4 / 3) * 3.14 * R ^ 3

PRINT “VOLUME OF SPHERE ”; V

END

USING SUB PROCEDURE

DECLARE SUB VOLUME(R)

CLS

INPUT “ENTER RADIUS”; R

CALL VOLUME(R)

END

SUB VOLUME (R)

V = (4 / 3) * 3.14 * R ^ 3

PRINT “VOLUME OF SPHERE ”; V

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION VOLUME (R)

CLS

INPUT “ENTER RADIUS”; R

PRINT “VOLUME OF SPHERE ”; VOLUME(R)

END

FUNCTION VOLUME (R)

VOLUME = (4 / 3) * 3.14 * R ^ 3

END FUNCTION

30. Display total surface area and volume of sphere.

REM PROGRAM TO DISPLAY TOTAL SURFACE AREA AND VOLUME OF SPHERE.

CLS

INPUT “ENTER RADIUS ”; R

A= 4 * 3.14 * R ^ 2

V = (4 / 3) * 3.14 * R ^ 3

PRINT “TOTAL SURFACE AREA OF SPHERE “; A

PRINT “VOLUME OF SPHERE ”; 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= 4 * 3.14 * R ^ 2

PRINT “TOTAL SURFACE AREA OF SPHERE “; A

END SUB

SUB VOLUME (R)

V = (4 / 3) * 3.14 * R ^ 3

PRINT “VOLUME OF SPHERE ”; V

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION TSAREA (R)

DECLARE FUNCTION VOLUME (R)

CLS

INPUT “ENTER RADIUS”; R

PRINT “TOTAL SURFACE AREA OF SPHERE ”; TSAREA(R)

PRINT “VOLUME OF SPHERE ”; VOLUME(R)

END

FUNCTION TSAREA (R)

TSAREA = 4 * 3.14 * R ^ 2

END FUNCTION

FUNCTION VOLUME (R)

VOLUME = (4 / 3) * 3.14 * R ^ 3

END FUNCTION

31. Display total surface area of hemisphere.

REM PROGRAM TO DISPLAY TOTAL SURFACE AREA OF HEMISPHERE.

CLS

INPUT “ENTER RADIUS ”; R

A= 3 * 3.14 * R ^ 2

PRINT “TOTAL SURFACE AREA OF HEMISPHERE “; A

END

USING SUB PROCEDURE

DECLARE SUB TSAREA (R)

CLS

INPUT “ENTER RADIUS”; R

CALL TSAREA(R)

END

SUB TSAREA (R)

A= 3 * 3.14 * R ^ 2

PRINT “TOTAL SURFACE AREA OF HEMISPHERE “; A

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION TSAREA (R)

CLS

INPUT “ENTER RADIUS”; R

PRINT “TOTAL SURFACE AREA OF HEMISPHERE ”; TSAREA(R)

END

FUNCTION TSAREA (R)

TSAREA = 3 * 3.14 * R ^ 2

END FUNCTION

32. Display volume of hemisphere.

REM PROGRAM TO DISPLAY VOLUME OF HEMISPHERE.

CLS

INPUT “ENTER RADIUS ”; R

V = (2 / 3) * 3.14 * R ^ 3

PRINT “VOLUME OF HEMISPHERE ”; V

END

USING SUB PROCEDURE

DECLARE SUB VOLUME(R)

CLS

INPUT “ENTER RADIUS”; R

CALL VOLUME(R)

END

SUB VOLUME (R)

V = (2 / 3) * 3.14 * R ^ 3

PRINT “VOLUME OF HEMISPHERE ”; V

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION VOLUME (R)

CLS

INPUT “ENTER RADIUS”; R

PRINT “VOLUME OF HEMISPHERE ”; VOLUME(R)

END

FUNCTION VOLUME (R)

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

END FUNCTION

33. 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

34. Display total surface area of 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

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

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

35. Display volume of cylinder.

REM PROGRAM TO DISPLAY VOLUME OF CYLINDER.

CLS

INPUT “ENTER RADIUS ”; R

INPUT “ENTER HEIGHT”; H

V = 3.14 * R ^ 2 * H

PRINT “VOLUME OF CYLINDER ”; V

END

USING SUB PROCEDURE

DECLARE SUB VOLUME(R, H)

CLS

INPUT “ENTER RADIUS”; R

INPUT “ENTER HEIGHT”; H

CALL VOLUME(R, H)

END

Explanation:

Hope it hepls

Similar questions