PI

A function returning 3.14159265.

X=PI

You can use PI to calculate the circumference and area of a circle. The example below calculates the circumference and area of a circle of a given radius.

10 CLS
20 INPUT "What is the radius of the circle ",rad
30 PRINT "The circumference is: ";2*PI*rad
40 PRINT "The area is: ";PI*rad*rad
50 END

PI can also be used to convert degrees to radians and radians to degrees.

radians=PI/180*degrees
degrees=180/PI*radians

However, BBC BASIC (Z80) has two functions (RAD and DEG) which perform these conversions to a higher accuracy.

Syntax

<n-var>=PI

Associated Keywords