How to calculate the perimeter and area of a circle using JavaScript?In this article, we will see how to calculate the perimeter and area of a circle using JavaScript. The mathematical formula for calculating the perimeter and area of the circle is given below: Area of circle = π * r * r Perimeter of circle = 2 * π * r Both formulae require the value of PI. So, in JavaScript, we have to use Math.PI property to get the value of PI. Let's see an example to calculate the perimeter and area of the circle. ExampleIn this example, the radius of the circle is 20cm. We have to click the given HTML button to get the area and perimeter. Test it NowOutput After the execution of above code and clicking the given button the output will be - Next TopicHow to create an image map in JavaScript |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India