Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //без функции max
- #include <iostream>
- using namespace std;
- int main()
- {
- int a, b, z;
- int max1, max2;
- cout << "Enter the numbers a & b: \n";
- cin >> a >> b;
- if (a > 2 * b) {
- max1 = a;
- }
- else {
- max1 = 2 * b;
- }
- if (2*a-b > b) {
- max2 = 2 * a - b;
- }
- else {
- max2 = b;
- }
- z = max1 * max2;
- cout << "Number z = " << z;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement