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