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