fork download
  1. #include <stdio.h>
  2. void cal(int x, int y, int *sum, int *diff, int *mul, int *mod) {
  3. *sum = x + y;
  4. *diff = abs(x - y);
  5. *mul = x * y;
  6. *mod = x / y;
  7. }
  8.  
  9. int main(void) {
  10. int x ,y ,sum ,diff ,mul ,mod;
  11. scanf("%d %d", &x, &y);
  12. cal(x, y, &sum, &diff, &mul, &mod);
  13. printf("和は %d\n", sum);
  14. printf("差は %d\n", diff);
  15. printf("積は %d\n", mul);
  16. printf("商は %d\n", mod);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5276KB
stdin
5 11
stdout
和は 16
差は 6
積は 55
商は 0