KarolWozniak

Zadanie 13

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