Michal_Pilarski

zad13

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