Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. function solve(radius, height) {
  2. let volume = 0;
  3. let slantHeight = 0;
  4. totalSurfaceArea = 0;
  5. pi = 3.14159
  6.  
  7.  
  8. slantHeight = Math.sqrt((radius * radius + height * height));
  9. volume = ((1/3 * pi) * (radius * radius)) * height;
  10. totalSurfaceArea = pi * radius * (radius + Math.sqrt(radius * radius + height * height));
  11.  
  12. console.log(`volume = ${volume.toFixed(4)}`);
  13. console.log(`area = ${totalSurfaceArea.toFixed(4)}`);
  14.  
  15. }
  16. solve(3, 5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement