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