fork download
  1. #include <stdio.h>
  2. //引数の絶対値を返す関数
  3. int abs(int x){
  4. if(x<0){
  5. x=-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,c;
  16. a=1;
  17. b=2;
  18. c=abs(square(a)-square(b));
  19. printf("|%d^2-%d^2|=%d\n",a,b,c);
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
|1^2-2^2|=3