aslv

Cylinder Volume

Jul 18th, 2014
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var input = [ {
  2.         radius: 2,
  3.         height: 4
  4.     }, {
  5.         radius: 5,
  6.         height: 8
  7.     }, {
  8.         radius: 12,
  9.         height: 3
  10.     }
  11. ];
  12.  
  13. function calcCylinder(value) {
  14.     var volume = Math.PI * value.radius * value.radius * value.height;
  15.     console.log(volume.toFixed(3));
  16. }
  17.  
  18. input.forEach(calcCylinder);
Advertisement
Add Comment
Please, Sign In to add comment