PI is a mathematical constant. The lowercase Greek letter π represents the symbol PI. It is an acronym of the periphery.
PI can be defined as the circumference (C) of a circle divided by its diameter (d). It means that for any size of the circle, the value of PI will remain constant.
The value of PI is generally used in formulae. Using Math.PI property, we can easily calculate the area of a circle and can perform other calculations that require the value of PI.
Let's see some illustrations of using the Math.PI property.
In this example, we are printing the value of the Math.PI property. Click the given button to get the value of PI.Test it Now
After the execution of above code and after clicking the given button the output will be -
In this example, we are calculating the area of the circle. The formula for finding the area is (π * r * r) that requires the value of PI. So, we are using Math.PI property to get the value of PI.
Here, the radius of the circle is 8.Test it Now