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