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