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