fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. void cal(int x,int y,int *sum,int *diff,int *mul,int *mod){
  5.  
  6. *sum = x+y;
  7.  
  8. *diff = x-y;
  9.  
  10. *mul = x*y;
  11.  
  12. *mod = x%y;}
  13.  
  14. int main(void) {
  15.  
  16. int x=3;
  17. int y=10;
  18.  
  19. int sum;
  20. int diff;
  21. int mul;
  22. int mod;
  23.  
  24. cal(x,y,&sum,&diff,&mul,&mod);
  25.  
  26. printf("x=%d y=%d\n",x,y);
  27. printf("和(sum)=%d\n",sum);
  28. printf("差(diff)=%d\n",diff);
  29. printf("積(mul)=%d\n",mul);
  30. printf("商(mod)=%d\n",mod);
  31.  
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
x=3   y=10
和(sum)=13
差(diff)=-7
積(mul)=30
商(mod)=3