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
6
2
stdout
sum=8
diff=4
mul=12
mod=3