A sphere is a perfectly round geometrical object that is three dimensional, with every point on its surface equidistant from its center. Many commonly-used objects such as balls or globes are spheres. If you want to calculate the volume of a sphere, you just have to find its radius and plug it into a simple formula, V = ⁴⁄₃πr³.Write a JavaScript script that will calculate the volume of a sphere, the volume should be fixed to 4 Decimal places.
let radius = prompt("Enter radius");
let volume = (4/3)* Math.PI * Math.pow(radius, 3);
console.log('Volume of Sphere: '+volume.toFixed(4));
Comments
Leave a comment