fork download
  1. #include <stdio.h>
  2.  
  3. // プロトタイプ宣言
  4. double max(double x, double y);
  5. double abs(double x);
  6. double cube(double x);
  7.  
  8. int main(void) {
  9. double a, b;
  10.  
  11. a = -3.2;
  12. b = 1.4;
  13.  
  14. printf("max(|%f|,(%f)^3)=%f\n",
  15. a, b, max(abs(a), cube(b)));
  16.  
  17. return 0;
  18. }
  19.  
  20. // 関数の定義
  21. double max(double x, double y){
  22. return (x > y) ? x : y;
  23. }
  24.  
  25. double abs(double x){
  26. return (x > 0) ? x : -x;
  27. }
  28.  
  29. double cube(double x){
  30. return x * x * x;
  31. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
max(|-3.200000|,(1.400000)^3)=3.200000