text: Program for volume of Pyramid | Function to find the volume of triangular pyramid ; Function to find the volume of square pyramid ; Function to find the volume of pentagonal pyramid ; Function to find the volume of hexagonal pyramid ; Driver Code
code: function volumeTriangular ( a , b , h ) { let vol = ( 0.1666 ) * a * b * h ; return vol ; } function volumeSquare ( b , h ) { let vol = ( 0.33 ) * b * b * h ; return vol ; } function volumePentagonal ( a , b , h ) { let vol = ( 0.83 ) * a * b * h ; return vol ; } function volumeHexagonal ( a , b , h ) { let vol = a * b * h ; return vol ; } let b = 4 , h = 9 , a = 4 ; document . write ( " " + " " + volumeTriangular ( a , b , h ) + " " ) ; document . write ( " " + " " + volumeSquare ( b , h ) + " " ) ; document . write ( " " + " " + volumePentagonal ( a , b , h ) + " " ) ; document . write ( " " + " " + volumeHexagonal ( a , b , h ) ) ;