Program to find slant height of cone and pyramid | Function to calculate slant height of a cone ; Store the slant height of cone ; Print the result ; Function to find the slant height of a pyramid ; Store the slant height of pyramid ; Print the result ; Dimensions of Cone ; Function Call for slant height of Cone ; Dimensions of Pyramid ; Function to calculate slant height of a pyramid
function coneSlantHeight ( cone_h , cone_r ) { var slant_height_cone = Math . sqrt ( Math . pow ( cone_h , 2 ) + Math . pow ( cone_r , 2 ) ) ; document . write ( " " + slant_height_cone + " " ) ; } function pyramidSlantHeight ( pyramid_h , pyramid_s ) { var slant_height_pyramid = Math . sqrt ( Math . pow ( pyramid_s / 2 , 2 ) + Math . pow ( pyramid_h , 2 ) ) ; document . write ( " " + slant_height_pyramid . toFixed ( 5 ) ) ; } var H1 = 4.5 , R = 6 ; coneSlantHeight ( H1 , R ) ; var H2 = 4 , S = 4.8 ; pyramidSlantHeight ( H2 , S ) ;