Calculate volume and surface area of a cone | javascript program to calculate Volume and Surface area of Cone ; Function to calculate Volume of cone ; Function to calculate Surface area of cone ; Driver Code ; Printing value of volume and surface area
const pi = 3.14159 ; function volume ( r , h ) { return ( ( 1 ) / ( 3 ) ) * pi * r * r * h ; } function surface_area ( r , s ) { return pi * r * s + pi * r * r ; } let radius = 5 ; let slant_height = 13 ; let height = 12 ; let vol , sur_area ; document . write ( " " + volume ( radius , height ) . toFixed ( 2 ) + " " ) ; document . write ( " " + surface_area ( radius , slant_height ) . toFixed ( 2 ) + " " ) ;