fork download
  1. #include <stdio.h>
  2.  
  3. //二つの値の和を返す関数
  4. int sum(int x, int y){
  5. int m;
  6. m=x+y;
  7. return m;
  8. }
  9.  
  10. //引数の三乗の値を返す関数
  11. int cube(int x){
  12. (x>0)?x:-x;
  13. return x*x*x;
  14. }
  15.  
  16. //main関数
  17. int main(void) {
  18. int a,b,c,d;
  19. a=1;
  20. b=-2;
  21. c=sum(a, b);
  22. d=cube(c);
  23. printf("%d+%dは%dであるなおその三乗は、%dである",a,b,c,d);
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5268KB
stdin
Standard input is empty
stdout
1+-2は-1であるなおその三乗は、-1である