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