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