fork download
  1. #include <stdio.h>
  2.  
  3.  
  4. int main(void) {
  5. int a, b;
  6. a = -3.2;
  7. b = 1.4;
  8. printf("max(|%d|,(%d)^3)=%d\n",a,b,max(abs(a),cube(b)));
  9. return 0;
  10. }
  11. //二つの引数の大きい方の値を返す関数
  12. int max(double x, double y){
  13. return (x>y)?x:y;
  14. }
  15.  
  16. //引数の絶対値を返す関数
  17. int abs(int x){
  18. return (x>0)?x:-x;
  19. }
  20.  
  21. //引数の三乗の値を返す関数
  22. int cube(int x){
  23. return x*x*x;
  24. }
  25.  
  26.  
  27.  
  28.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
max(|-3|,(1)^3)=0