fork(1) 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. printf("x : "); scanf("%d",&x);
  7. printf("y : "); scanf("%d",&y);
  8. cal(x,y,&a,&b,&c,&d);
  9. printf("sum:%d diff:%d mul:%d mod:%d \n",a,b,c,d);
  10.  
  11. return 0;
  12. }
  13. void cal(int x,int y,int *sum,int *diff,int *mul,int *mod)
  14. {
  15. *sum= x+y;
  16. if(x<y){
  17. *diff= y-x;
  18. }
  19. else{
  20. *diff=x-y;
  21. }
  22. *mul= x*y;
  23. *mod= x/y;
  24. }
Success #stdin #stdout 0s 5280KB
stdin
5
6
stdout
x : y : sum:11 diff:1 mul:30 mod:0