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