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