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