QBASIC – Circumference of Circle

Below is the QBASIC program to calculate the circumference of a circle.

REM Program to find perimeter of circle
CLS
INPUT "Enter the radius: "; r
perimeter = 2 * 3.14 * r
PRINT "Perimeter of the circle is: ";perimeter
END

Explanation:

Let’s first see the formula: Perimeter = 2 * pi * r, where the value of pi is 3.14. So, we can determine the perimeter of a circle by taking the radius of the circle from the user and multiplying the value of pi by 2 and the radius of the circle.

Leave a Comment

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

Exit mobile version