fork download
  1. #include <stdio.h>
  2. void cal(int x,int y,int *sum,int *diff,int *mul,int *mod);
  3.  
  4. int main(void) {
  5. int x,y,sum,diff,mul,mod;
  6. printf("x:");
  7. scanf("%d",&x);
  8. printf("y:");
  9. scanf("%d",&y);
  10.  
  11. cal(x,y,&sum,&diff,&mul,&mod);
  12. printf("sum:%d diff:%d mul:%d mod:%d\n",sum,diff,mul,mod);
  13. return 0;
  14. }
  15.  
  16. void cal(int x,int y,int *sum,int *diff,int *mul,int *mod){
  17.  
  18. *sum=x+y;
  19. *diff=(x>y)?(x-y):(y-x);
  20. *mul=x*y;
  21. *mod=x%y;
  22.  
  23. }
Success #stdin #stdout 0s 5284KB
stdin
3
4
stdout
x:y:sum:7 diff:1 mul:12 mod:3