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. *diff=x>y?x-y:y-x;
  5. *mul=x*y;
  6. *mod=x/y;
  7. }
  8.  
  9. int main(){
  10. int x,y,sum,diff,mul,mod;
  11. scanf("%d %d",&x,&y);
  12. cal(x,y,&sum,&diff,&mul,&mod);
  13. printf("和は%d\n",sum);
  14. printf("差は%d\n",diff);
  15. printf("積は%d\n",mul);
  16. printf("商は%d\n",mod);
  17. return 0;
  18. }
Success #stdin #stdout 0s 5284KB
stdin
1 4
stdout
和は5
差は3
積は4
商は0