fork download
  1. #include <stdio.h>
  2.  
  3. void cal(int x, int y, int *sum, int *diff, int *mul, int *mod);
  4. int abs(int a);
  5.  
  6. int main(void)
  7. {
  8. int x,y,sum,diff,mul,mod;
  9. printf("x:");
  10. scanf("%d",&x);
  11. printf("y:");
  12. scanf("%d",&y);
  13.  
  14. cal(x,y,&sum,&diff,&mul,&mod);
  15.  
  16. printf("sum:%d,diff:%d,mul:%d,mod:%d\n",sum,diff,mul,mod);
  17. return 0;
  18. }
  19.  
  20. void cal(int x, int y, int *sum, int *diff, int *mul, int *mod)
  21. {
  22. *sum=x+y;
  23. *diff=abs(x-y);
  24. *mul=x*y;
  25. *mod=x/y;
  26. }
  27. int abs(int a)
  28. {
  29. if(a<0){
  30. return -a;
  31. }
  32. else{
  33. return a;
  34. }
  35. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
x:y:sum:674784413,diff:674718883,mul:2041074208,mod:20593