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