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