#include <stdio.h>
void cal(int x, int y, int *sum, int *diff, int *mul, int *mod);
int main(void) {
int x=3, y=0;
int sum, diff, mul, mod;
cal(x, y, &sum, &diff, &mul, &mod);
return 0;
}
void cal(int x, int y, int *sum, int *diff, int *mul, int *mod){
if(y!=0){
*sum = x + y;
*diff = x - y;
*mul = x * y;
*mod = x / y;}
else
{ *sum = x + y;
*diff = x - y;
*mul = x * y;
*mod =0;
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIGNhbChpbnQgeCwgaW50IHksIGludCAqc3VtLCBpbnQgKmRpZmYsIGludCAqbXVsLCBpbnQgKm1vZCk7CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgeD0zLCB5PTA7CiAgICBpbnQgc3VtLCBkaWZmLCBtdWwsIG1vZDsKICAgIHByaW50ZigieCA6ICIpOyBzY2FuZigiJWQiLCAmeCk7CiAgICBwcmludGYoInkgOiAiKTsgc2NhbmYoIiVkIiwgJnkpOwogICAgY2FsKHgsIHksICZzdW0sICZkaWZmLCAmbXVsLCAmbW9kKTsKICAgIHByaW50ZigieCArIHkgPSAlZFxuIiwgc3VtKTsKICAgIHByaW50ZigieCAtIHkgPSAlZFxuIiwgZGlmZik7CiAgICBwcmludGYoInggKiB5ID0gJWRcbiIsIG11bCk7CiAgICBwcmludGYoInggLyB5ID0gJWRcbiIsIG1vZCk7CiAgICByZXR1cm4gMDsKfQp2b2lkIGNhbChpbnQgeCwgaW50IHksIGludCAqc3VtLCBpbnQgKmRpZmYsIGludCAqbXVsLCBpbnQgKm1vZCl7CmlmKHkhPTApewogICAgKnN1bSA9IHggKyB5OwogICAgKmRpZmYgPSB4IC0geTsKICAgICptdWwgPSB4ICogeTsKICAgICptb2QgPSB4IC8geTt9CmVsc2UKeyAqc3VtID0geCArIHk7CiAgICAqZGlmZiA9IHggLSB5OwogICAgKm11bCA9IHggKiB5OwogICAgKm1vZCA9MDsKfQp9