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