QBASIC – Volume of a hemisphere

Table of Contents

Program

Below is the QBASIC program to calculate the volume of a hemisphere.

REM Program to find volume of hemisphere
CLS
INPUT "Enter the radius: "; r
volumen = 2/3 * 3.14 * r ^ 3
PRINT "Volume of a hemisphere is: ";volume
END

Output

Explanation

Let’s first see the formula: volume = 2/3 * pi * r ^ 3, where the value of pi is 3.14. So, we can determine the volume of any hemisphere by taking the radius of the circle from the user and multiplying the value of pi by 2/3, and the radius of the circle raised to the power of 3.

More Programs

https://thinkshare.one/learn/programming/qbasic/

Leave a Comment

Your email address will not be published. Required fields are marked *

Exit mobile version