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