Advertisement
vladovip

JS - Cone

Dec 31st, 2021
958
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (coneRadius, coneHeight) {
  2.  
  3. let coneVolume = 0;
  4. let totalSurfaceArea = 0;
  5.  
  6. coneVolume = (1/3 * Math.PI * Math.pow(coneRadius, 2) * coneHeight).toFixed(4);
  7. totalSurfaceArea = (Math.PI* coneRadius*(coneRadius + (Math.sqrt(coneRadius*coneRadius + coneHeight*coneHeight )))).toFixed(4);
  8.  
  9. console.log( `volume = ${coneVolume}`);
  10. console.log( `area = ${totalSurfaceArea}`);
  11.  
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement