#include <stdio.h>
void cal(int x, int y, int *sum, int *diff, int *mul, int *mod);
int main(void) {
int x, y, sum, diff, mul, mod;
x=2;
y=4;
cal(x, y, &sum, &diff, &mul, &mod);
printf("sum:%d diff:%d mul:%d mod:%d \n", sum
, diff
, mul
, mod
);
return 0;
}
void cal(int x, int y, int *sum, int *diff, int *mul, int *mod)
{
*sum = x+y;
*diff = x-y;
if(*diff<0){
*diff=(-*diff);
}
*mul = x*y;
*mod= x%y;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIGNhbChpbnQgeCwgaW50IHksIGludCAqc3VtLCBpbnQgKmRpZmYsIGludCAqbXVsLCBpbnQgKm1vZCk7CgppbnQgbWFpbih2b2lkKSB7CglpbnQgeCwgeSwgc3VtLCBkaWZmLCBtdWwsIG1vZDsKCQl4PTI7CgkJeT00OwoKCWNhbCh4LCB5LCAmc3VtLCAmZGlmZiwgJm11bCwgJm1vZCk7CgkKCXByaW50Zigic3VtOiVkIGRpZmY6JWQgbXVsOiVkIG1vZDolZCBcbiIsIHN1bSwgZGlmZiwgbXVsLCBtb2QpOwoJCglyZXR1cm4gMDsKfQoKdm9pZCBjYWwoaW50IHgsIGludCB5LCBpbnQgKnN1bSwgaW50ICpkaWZmLCBpbnQgKm11bCwgaW50ICptb2QpCnsKCSpzdW0gPSB4K3k7CgkqZGlmZiA9IHgteTsKCWlmKCpkaWZmPDApewoJCSpkaWZmPSgtKmRpZmYpOwoJfQoJKm11bCA9IHgqeTsKCSptb2Q9IHgleTsKCn0K