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