Michal_Bilski

zad13

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