Advertisement
ULK

Д. М. Златопольский (10.3.)

ULK
May 15th, 2023 (edited)
1,037
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. //с функцией max
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int max(int m, int n) {
  6.     if (m > n) {
  7.         return m;
  8.     }
  9.     else {
  10.         return n;
  11.     }
  12. }
  13.  
  14. int main()
  15. {
  16.     int a, b, z;
  17.     cout << "Enter the numbers a & b: \n";
  18.     cin >> a >> b;
  19.  
  20.    
  21.  
  22.     z = max(a, 2 * b) * max(2*a-b,b);
  23.     cout << "Number z = " << z;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement