text: Maximize volume of cuboid with given sum of sides | Return the maximum volume . ; Return the maximum volume . ; finding length ; finding breadth ; finding height ; Driven Program
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; int maxvolume ( int s ) { int length = s / 3 ; s -= length ; int breadth = s / 2 ; int height = s - breadth ; return length * breadth * height ; } int main ( ) { int s = 8 ; cout << maxvolume ( s ) << endl ; return 0 ; }