# Maximum of smallest possible area that can get with exactly k cut of given rectangular in C++

C++Server Side ProgrammingProgramming

#### C in Depth: The Complete C Programming Guide for Beginners

45 Lectures 4.5 hours

#### Practical C++: Learn C++ Basics Step by Step

Most Popular

50 Lectures 4.5 hours

#### Master C and Embedded C Programming- Learn as you go

66 Lectures 5.5 hours

In this tutorial, we will be discussing a program to find the maximum of smallest possible area that can get with exactly k cut of given rectangular.

For this we will be provided with the sides of the rectangle and the number of cuts that can be made. Our task is to calculate the smallest area that can be achieved by making the given number of cuts.

## Example

Live Demo

#include <bits/stdc++.h>
using namespace std;
void max_area(int n, int m, int k) {
if (k > (n + m - 2))
cout << "Not possible" << endl;
else {
int result;
if (k < max(m, n) - 1) {
result = max(m * (n / (k + 1)), n * (m / (k + 1)));
}
else {
result = max(m / (k - n + 2), n / (k - m + 2));
}
cout << result << endl;
}
}
int main() {
int n = 3, m = 4, k = 1;
max_area(n, m, k);
return 0;
}

## Output

6