text: Maximize volume of cuboid with given sum of sides | Return the maximum volume . ; for length ; for breadth ; for height ; calculating maximum volume . ; Driver Code
code: < ? php function maxvolume ( $ s ) { $ maxvalue = 0 ; for ( $ i = 1 ; $ i <= $ s - 2 ; $ i ++ ) { for ( $ j = 1 ; $ j <= $ s - 1 ; $ j ++ ) { $ k = $ s - $ i - $ j ; $ maxvalue = max ( $ maxvalue , $ i * $ j * $ k ) ; } } return $ maxvalue ; } $ s = 8 ; echo ( maxvolume ( $ s ) ) ; ? >