Advertisement
PowerCell46

Cone math task JS

Nov 22nd, 2022
809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function cone(radius, height) {
  2. let slantHeightOfCone = Math.sqrt(radius * radius + height * height);
  3. let lateralSurfaceAreaOfCone = Math.PI * radius * slantHeightOfCone;
  4. let baseSurfaceAreaOfCone = Math.PI * radius * radius;
  5. let areaTotal = lateralSurfaceAreaOfCone + baseSurfaceAreaOfCone;
  6.  
  7.  
  8. let volume = ((Math.PI * radius * radius * height) / 3);
  9.  
  10.  
  11.  
  12. console.log(`volume = ${volume.toFixed(4)}`);
  13. console.log(`area = ${areaTotal.toFixed(4)}`);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement