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;
  7. int sum, diff, mul, mod;
  8.  
  9. scanf("%d", &x);
  10. scanf("%d", &y);
  11.  
  12. cal(x, y, &sum, &diff, &mul, &mod);
  13.  
  14. printf("和=%d\n", sum);
  15. printf("差=%d\n", diff);
  16. printf("積=%d\n", mul);
  17. printf("商=%d\n", mod);
  18.  
  19. return 0;
  20. }
  21.  
  22. void cal(int x, int y, int *sum, int *diff, int *mul, int *mod){
  23.  
  24. *sum = x + y;
  25.  
  26. *diff = (x > y) ? (x - y) : (y -x);
  27.  
  28. *mul = x * y;
  29. *mod = x / y;
  30. }
  31.  
  32.  
  33.  
  34.  
Success #stdin #stdout 0s 5292KB
stdin
2 4
stdout
和=6
差=2
積=8
商=0