Skip to content

Instantly share code, notes, and snippets.

@MladenMladenov
Created January 7, 2016 08:14
Show Gist options
  • Save MladenMladenov/ec4f34b8d0ae0798c6ef to your computer and use it in GitHub Desktop.
Save MladenMladenov/ec4f34b8d0ae0798c6ef to your computer and use it in GitHub Desktop.
function calcCylinderVol(arr){
var radius =Number(arr[0]) ;
var height = Number(arr[1]);
var volume = Math.PI*(Math.pow(radius,2))*height;
var precisevolume = volume.toFixed(3);
console.log(precisevolume);
}
var arr=[2,4];
calcCylinderVol(arr);
var arr=[5,8];
calcCylinderVol(arr);
var arr=[12,3];
calcCylinderVol(arr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment