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. *diff=abs(x-y);
  6. *mul=x*y;
  7. *mod=x/y;
  8. }
  9.  
  10. int main(void){
  11. int x=10;
  12. int y=4;
  13. int sum,diff,mul,mod;
  14.  
  15. cal(x,y,&sum,&diff,&mul,&mod);
  16.  
  17. printf("和 %d+%d=%d\n",x,y,sum);
  18. printf("差 %d-%d=%d\n",x,y,diff);
  19. printf("積 %d×%d=%d\n",x,y,mul);
  20. printf("商 %d÷%d=%d\n",x,y,mod);
  21.  
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
和 10+4=14
差 10-4=6
積 10×4=40
商 10÷4=2