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