MarcinKrol

Zad13

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