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