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