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