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