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: < ? php function volumeTriangular ( $ a , $ b , $ h ) { $ vol = ( 0.1666 ) * $ a * $ b * $ h ; return $ vol ; } function volumeSquare ( $ b , $ h ) { $ vol = ( 0.33 ) * $ b * $ b * $ h ; return $ vol ; } function volumePentagonal ( $ a , $ b , $ h ) { $ vol = ( 0.83 ) * $ a * $ b * $ h ; return $ vol ; } function volumeHexagonal ( $ a , $ b , $ h ) { $ vol = $ a * $ b * $ h ; return $ vol ; } $ b = 4 ; $ h = 9 ; $ a = 4 ; echo ( " Volume ▁ of ▁ triangular ▁ base ▁ pyramid ▁ is ▁ " ) ; echo ( volumeTriangular ( $ a , $ b , $ h ) ) ; echo ( " STRNEWLINE " ) ; echo ( " Volume ▁ of ▁ square ▁ base ▁ pyramid ▁ is ▁ " ) ; echo ( volumeSquare ( $ b , $ h ) ) ; echo ( " STRNEWLINE " ) ; echo ( " Volume ▁ of ▁ pentagonal ▁ base ▁ pyramid ▁ is ▁ " ) ; echo ( volumePentagonal ( $ a , $ b , $ h ) ) ; echo ( " STRNEWLINE " ) ; echo ( " Volume ▁ of ▁ Hexagonal ▁ base ▁ pyramid ▁ is ▁ " ) ; echo ( volumeHexagonal ( $ a , $ b , $ h ) ) ; ? >