fork download
  1. #include <stdio.h>
  2. //引数の絶対値を返す関数
  3. int abs(int x){
  4. if(x<0){
  5. x = -1*x;
  6. }
  7. return x;
  8. }
  9. //引数の二乗を返す関数
  10. int square(int x){
  11. return x*x;
  12. }
  13. //main関数
  14. int main(void) {
  15. int a,b;
  16. a = 1;
  17. b = 2;
  18. printf("f(%d,%d)=%d",a,b,abs(square(a)-square(b)));
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
f(1,2)=3