#include <stdio.h>
void cal(int *x, int *y,int *sum, int *diff, int *mul, int *mod);
void swap(int *x,int *y);
void sort(int *x,int *y);
int main(void) {
int sum,mul,diff,mod;
int x=3;
int y=10;
sort(&x,&y);
cal(&x,&y,&sum,&diff,&mul,&mod);
printf("x=%d\ny=%d\nsum=%d\ndiff=%d\nmul=%d\nmod=%d",x
,y
,sum
,diff
,mul
,mod
); return 0;
}
void sort(int *x,int *y){
if(*x<*y){
swap(x,y);
}
}
void swap(int *x,int *y){
int temp;
temp=*x;
*x=*y;
*y=temp;
}
void cal(int *x, int *y, int *sum, int *diff, int *mul, int *mod){
*sum=*x+*y;
*diff=(*x>*y)?(*x-*y):(*y-*x);
*mul=(*x)*(*y);
*mod=(*x)/(*y);
}
I2luY2x1ZGUgPHN0ZGlvLmg+CnZvaWQgY2FsKGludCAqeCwgaW50ICp5LGludCAqc3VtLCBpbnQgKmRpZmYsIGludCAqbXVsLCBpbnQgKm1vZCk7CnZvaWQgc3dhcChpbnQgKngsaW50ICp5KTsKdm9pZCBzb3J0KGludCAqeCxpbnQgKnkpOwppbnQgbWFpbih2b2lkKSB7CglpbnQgc3VtLG11bCxkaWZmLG1vZDsKCWludCB4PTM7CglpbnQgeT0xMDsKCXNvcnQoJngsJnkpOwoJY2FsKCZ4LCZ5LCZzdW0sJmRpZmYsJm11bCwmbW9kKTsKCXByaW50ZigieD0lZFxueT0lZFxuc3VtPSVkXG5kaWZmPSVkXG5tdWw9JWRcbm1vZD0lZCIseCx5LHN1bSxkaWZmLG11bCxtb2QpOwoJcmV0dXJuIDA7Cn0Kdm9pZCBzb3J0KGludCAqeCxpbnQgKnkpewoJaWYoKng8KnkpewoJCXN3YXAoeCx5KTsKCX0KfQp2b2lkIHN3YXAoaW50ICp4LGludCAqeSl7CglpbnQgdGVtcDsKCXRlbXA9Kng7CgkqeD0qeTsKCSp5PXRlbXA7Cn0Kdm9pZCBjYWwoaW50ICp4LCBpbnQgKnksIGludCAqc3VtLCBpbnQgKmRpZmYsIGludCAqbXVsLCBpbnQgKm1vZCl7Cgkqc3VtPSp4Kyp5OwoJKmRpZmY9KCp4Pip5KT8oKngtKnkpOigqeS0qeCk7CgkqbXVsPSgqeCkqKCp5KTsKCSptb2Q9KCp4KS8oKnkpOwp9Cg==