fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void cal(int x, int y, int *sum, int *diff, int *mul, int *mod);
  5.  
  6. int main(void) {
  7. int x = 3;
  8. int y = 10;
  9. int sum;
  10. int diff;
  11. int mul;
  12. int mod;
  13. cal(x, y, &sum, &diff, &mul, &mod);
  14.  
  15. printf("x = %d, y = %d\n", x, y);
  16. printf("和:%d\n", sum);
  17. printf("差:%d\n", diff);
  18. printf("積:%d\n", mul);
  19. printf("商:%d\n", mod);
  20.  
  21. return 0;
  22. }
  23.  
  24. void cal(int x, int y, int *sum, int *diff, int *mul, int *mod) {
  25. *sum = x + y;
  26. *diff = abs(x - y);
  27. *mul = x * y;
  28. *mod = x / y;
  29. }
  30.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
x = 3, y = 10
和:13
差:7
積:30
商:0