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. if(x>=y){
  6. *diff=x-y;
  7. }else{*diff=y-x;
  8. }
  9. *mul=x*y;
  10. *mod=x%y;
  11. }
  12. int main(void) {
  13. // your code goes here
  14. int x,y,sum,diff,mul,mod;
  15. scanf("%d%d",&x,&y);
  16. cal(x,y,&sum,&diff,&mul,&mod);
  17. printf("和:%d,差:%d,積:%d,剰余:%d\n",sum,diff,mul,mod);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5320KB
stdin
12
6
stdout
和:18,差:6,積:72,剰余:0