fork download
  1. #include <stdio.h>
  2.  
  3. double max(double x, double y);
  4. double abs(double x);
  5. double cube(double x);
  6.  
  7. int main(void) {
  8. double a, b;
  9. a = -3.2;
  10. b = 1.4;
  11. printf("max(|%.2f|, (%.2f)^3) = %.2f\n", a, b, max(abs(a), cube(b)));
  12. return 0;
  13. }
  14.  
  15. double max(double x, double y) {
  16. return (x > y) ? x : y;
  17. }
  18.  
  19. double abs(double x) {
  20. return (x > 0) ? x : -x;
  21. }
  22.  
  23. double cube(double x) {
  24. return x * x * x;
  25. }
  26.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
max(|-3.20|, (1.40)^3) = 3.20