Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Write a JavaScript function calcCylinderVol(arr) that accepts the following parameters:
- radius and the height of a straight circular cylinder. The function calculates
- the volume of the cylinder. Write JS program cylinderVol.js that calculates the volume of
- a few cylinders. The result should be printed on the console. */
- "use strict";
- function calcCylinderVol(arr) {
- return Math.PI * arr[0] * arr[0] * arr[1];
- }
- console.log(calcCylinderVol([2, 4]).toFixed(3));
- console.log(calcCylinderVol([5, 8]).toFixed(3));
- console.log(calcCylinderVol([12, 3]).toFixed(3));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement