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.  
  8. scanf("%d %d",&x, &y);
  9.  
  10. cal( x, y, &sum, &diff, &mul, &mod);
  11.  
  12. printf(" sum=%d \n diff=%d \n mul=%d \n mod=%d", 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. *sum=x+y;
  19. *diff=x-y;
  20. if(*diff<0) *diff=(-1)*(*diff);
  21. *mul=x*y;
  22. *mod=x/y;
  23.  
  24. }
Success #stdin #stdout 0s 5284KB
stdin
3
5
stdout
 sum=8 
 diff=2 
 mul=15 
 mod=0