text: Maximize volume of cuboid with given sum of sides | Java code to Maximize volume of cuboid with given sum of sides ; Return the maximum volume . ; finding length ; finding breadth ; finding height ; Driven Program
code: import java . io . * ; class GFG { static int maxvolume ( int s ) { int length = s / 3 ; s -= length ; int breadth = s / 2 ; int height = s - breadth ; return length * breadth * height ; } public static void main ( String [ ] args ) { int s = 8 ; System . out . println ( maxvolume ( s ) ) ; } }