fork download
  1. #include <stdio.h>
  2.  
  3. void cal(int x, int y, int *sum, int *diff, int *mul, int *mod);
  4.  
  5. int main(void) {
  6. int x, y, s, d, m, M;
  7. printf("x : ");scanf("%d",&x);
  8. printf("y : ");scanf("%d",&y);
  9.  
  10. cal(x,y,&s,&d,&m,&M);
  11.  
  12. printf("sum:%d,diff:%d,mul:%d,mod:%d",s,d,m,M);
  13.  
  14. return 0;
  15. }
  16.  
  17. void cal (int x, int y, int *sum, int *diff, int *mul, int *mod){
  18. *sum = x+y;
  19. *diff = abs(x,y);
  20. *mul = x*y;
  21. *mod = x%y;
  22. }
  23. int abs (int a,int b){
  24. int B = a-b;
  25. if (B<0){
  26. return -B;
  27. }
  28. else return B;
  29. }
  30.  
Success #stdin #stdout 0s 5288KB
stdin
34
44
stdout
x : y : sum:78,diff:10,mul:1496,mod:34