fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int MAX(int x, int y) {
  6. if (x < y)
  7. return y;
  8. else
  9. return x;
  10. }
  11.  
  12. int main() {
  13. int a, b, c, P, Z, Q;
  14.  
  15. // Input nilai a, b, c
  16. cin >> a;
  17. cin >> b;
  18. cin >> c;
  19.  
  20. // Mencari nilai maksimum
  21. P = MAX(a, b);
  22. cout << P << endl;
  23.  
  24. Z = MAX(a + b, a * b);
  25. cout << Z << endl;
  26.  
  27. Q = MAX(MAX(a, b), c);
  28. cout << Q << endl;
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0s 5312KB
stdin
5
3
7
stdout
5
15
7