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