Advertisement
JakubKaczmarek

Zad 13

Mar 31st, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int MAX(int a, int b, int c)
  6. {
  7.     if(a>b)
  8.     {
  9.         if(a>c)
  10.         {
  11.             return a;
  12.         }
  13.         else
  14.         {
  15.             return c;
  16.         }
  17.     }
  18.     else if(b>a)
  19.     {
  20.         if(b>c)
  21.         {
  22.             return b;
  23.         }
  24.         else
  25.         {
  26.             return c;
  27.         }
  28.     }
  29. }
  30.  
  31. int main()
  32. {
  33.     cout << MAX(1,2,4) << endl;
  34.     cout << MAX(5,111,32) << endl;
  35.     cout << MAX(49,33,41) << endl;
  36.     cout << MAX(8,29,1) << endl;
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement