QBASIC – Total Surface Area of a cylinder

Program

Below is the QBASIC program to calculate the total surface area of a cylinder.

REM Program to find total surface area of cylinder
CLS
INPUT "Enter the radius: "; r
INPUT "Enter the height: "; h
tsa = 2 * 3.14 * r * (r + h)
PRINT "Total Surface Area of a cylinder is: ";tsa
END

Output

Total Surface Area of a cylinder QBASIC

Explanation

Let’s first see the formula: tsa = 2 * 3.14 * r * (r + h) , where the value of pi is 3.14. So, we can determine the total surface area of any cylinder by taking the radius and height of the cylinder from the user and multiplying the value of pi by 2, the radius, and the sum of radius and height.

More Programs

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

Leave a Comment

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