Maximize volume of cuboid with given sum of sides | Return the maximum volume . ; finding length ; finding breadth ; finding height ; Driven Code
< ? php function maxvolume ( $ s ) { $ length = ( int ) ( $ s / 3 ) ; $ s -= $ length ; $ breadth = ( int ) ( $ s / 2 ) ; $ height = $ s - $ breadth ; return $ length * $ breadth * $ height ; } $ s = 8 ; echo ( maxvolume ( $ s ) ) ; ? >