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. scanf("%d",&x);
  8. printf("x:%d\n",x);
  9. scanf("%d",&y);
  10. printf("y:%d\n",y);
  11.  
  12.  
  13. cal(x,y,&sum,&diff,&mul,&mod);
  14. printf("sum = %d\n", sum);
  15. printf("diff = %d\n", diff);
  16. printf("mul = %d\n", mul);
  17. printf("mod = %d\n", mod);
  18. return 0;
  19. }
  20.  
  21. void cal(int x, int y, int *sum, int *diff, int *mul, int *mod){
  22. *sum = x + y;
  23.  
  24. if (x > y)
  25. *diff = x - y;
  26. else
  27. *diff = y - x;
  28.  
  29. *mul = x * y;
  30.  
  31. *mod = x / y;
  32. }
  33.  
  34.  
Success #stdin #stdout 0.01s 5324KB
stdin
3 7
stdout
x:3
y:7
sum  = 10
diff = 4
mul  = 21
mod  = 0