- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Find maximum volume of a cuboid from the given perimeter and area in C++

Suppose we have the area A and a perimeter P, now we have to find what will be the maximum volume that can be made in form of cuboid from given perimeter and surface area. So when the P is 24 and A is 24, then the output will be 8.

As we know for given perimeter of cuboid P = 4(length + breadth + Depth), for area, it will be A = 2(length* breadth + breadth*Depth + length *Depth), and the volume is V = (length* breadth*Depth)

## Example

#include<iostream> #include<cmath> using namespace std; float maxVolumeCuboid(float Peri, float Area) { float length = (Peri - sqrt(Peri * Peri - 24 * Area)) / 12; float Vol = length * (Area / 2.0 - length * (Peri / 4.0 - length)); return Vol; } int main() { float P = 20, A = 16; cout << "Maximum volume of the cuboid will be: " << maxVolumeCuboid(P, A); }

## Output

Maximum volume of the cuboid will be: 4.14815

- Related Articles
- Program for Volume and Surface Area of Cuboid in C++
- Java Program to Find the Surface area and Volume of Cuboid
- Swift Program to Find the Surface area and Volume of Cuboid
- Haskell Program to Find the Surface area and Volume of Cuboid
- Kotlin Program to Find the Surface Area and Volume of Cuboid
- How to find the Surface area and Volume of Cuboid in Golang?
- Maximum area of rectangle possible with given perimeter in C++
- Golang program to Calculate the Volume, Diagonal and Area of a Cuboid?
- Maximize volume of cuboid with given sum of sides in C++
- Program to find the Area and Perimeter of a Semicircle in C++
- Program to find the Area and Volume of Icosahedron in C++
- How many times area is of perimeter how to find area when perimeter is given?
- Maximum Perimeter Triangle from array in C++
- How to find Volume and Surface Area of a Sphere using C#?
- The area of 3 adjacent faces of a cuboid are in the ratio of $2:3:4$ and the volume is $9000 cm^3$, find the shortestt side.

Advertisements