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