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