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