fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. double a, b, c, d, x;
  5.  
  6. scanf("%lf", &a);
  7. scanf("%lf", &b);
  8. scanf("%lf", &c);
  9. scanf("%lf", &d);
  10.  
  11. x = a;
  12. if (b > x) {
  13. x = b;
  14. }
  15. if (c > x) {
  16. x = c;
  17. }
  18. if (d > x) {
  19. x = d;
  20. }
  21.  
  22. if ((a + c) < (b - d)) {
  23. x = x + (a + c);
  24. }
  25. else {
  26. x = x + (b - d);
  27. }
  28.  
  29. printf("x = %.4f\n", x);
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
x = 0.0000