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