fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int MAX(int x, int y) {
  5. return (x < y) ? y : x;
  6. }
  7.  
  8. void proses() {
  9. int a, b, c, P, Z, Q;
  10. cin >> a;
  11. cin >> b;
  12. cin >> c;
  13. P = MAX(a, b);
  14. Z = MAX(a + b, a * b);
  15. Q = MAX(MAX(a, b), c);
  16. // Output hasil jika diperlukan
  17. cout << "P = " << P << endl;
  18. cout << "Z = " << Z << endl;
  19. cout << "Q = " << Q << endl;
  20. }
  21.  
  22. int main() {
  23. proses();
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5320KB
stdin
5
3
7
stdout
P = 5
Z = 15
Q = 7