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