Given the perimeter of a rectangle, the task is to find the maximum area of a rectangle which can use n-unit length as its perimeter.
Note: Length and Breadth must be an integral value.
Input: perimeter = 15 Output: Maximum Area = 12 Input: perimeter = 16 Output: Maximum Area = 16
Approach: For area to be maximum of any rectangle the difference of length and breadth must be minimal. So, in such case the length must be ceil (perimeter / 4) and breadth will be be floor(perimeter /4). Hence the maximum area of a rectangle with given perimeter is equal to ceil(perimeter/4) * floor(perimeter/4).
Below is the implementation of the above approach:
Maximum Area = 90
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Maximum area of a Rectangle that can be circumscribed about a given Rectangle of size LxW
- Program for Area And Perimeter Of Rectangle
- Ratio of area of a rectangle with the rectangle inscribed in it
- Program to find all possible triangles having same Area and Perimeter
- Find maximum volume of a cuboid from the given perimeter and area
- Program to find Perimeter / Circumference of Square and Rectangle
- Program to calculate area and perimeter of a rhombus whose diagonals are given
- Area of the biggest possible rhombus that can be inscribed in a rectangle
- Sum of Area of all possible square inside a rectangle
- Program to calculate area and perimeter of Trapezium
- Program to calculate area and perimeter of equilateral triangle
- Program to find the Area and Perimeter of a Semicircle
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle
- Perimeter and Area of Varignon's Parallelogram
- Area of a Square | Using Side, Diagonal and Perimeter
- Largest subset of rectangles such that no rectangle fit in any other rectangle
- Count number of right triangles possible with a given perimeter
- Maximum area rectangle by picking four sides from array
- Number of squares of maximum area in a rectangle
- Rectangle with Maximum Area using Java Pair
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.