JavaScript program to calculate circle circumference

Views: 649   

Following program shows you how to calculate circle circumference.
In this program we get circle radius from user and calculate circumference using following formula
Circumference = 2 X PI X r

var circleRadius = parseInt(prompt("Please enter the radius of circle:"));
var circumferenceOfCircle = 2 * Math.PI * circleRadius;
console.log("Circumference of circle is: " + circumferenceOfCircle);

Output:

Please enter the radius of circle:
12
Circumference of circle is: 75.39822368615503
On By