#include <stdio.h>
void cal(int x, int y, int *sum, int *diff, int *mul, int *mod);
int main(void) {
int x=2, y=3, sum, diff, mul, mod;
cal(x, y, &sum, &diff, &mul, &mod);
printf("x, y の和: %d, 差: %d, 積: %d, 商: %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;
*mul = x * y;
*mod = x / y;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIGNhbChpbnQgeCwgaW50IHksIGludCAqc3VtLCBpbnQgKmRpZmYsIGludCAqbXVsLCBpbnQgKm1vZCk7CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgeD0yLCB5PTMsIHN1bSwgZGlmZiwgbXVsLCBtb2Q7CgogICAgY2FsKHgsIHksICZzdW0sICZkaWZmLCAmbXVsLCAmbW9kKTsKCiAgICBwcmludGYoIngsIHkg44Gu5ZKMOiAlZCwg5beuOiAlZCwg56mNOiAlZCwg5ZWGOiAlZFxuIiwgc3VtLCBkaWZmLCBtdWwsIG1vZCk7CgogICAgcmV0dXJuIDA7Cn0KCnZvaWQgY2FsKGludCB4LCBpbnQgeSwgaW50ICpzdW0sIGludCAqZGlmZiwgaW50ICptdWwsIGludCAqbW9kKSB7CiAgICAqc3VtID0geCArIHk7CiAgICAqZGlmZiA9IHggLSB5OwogICAgKm11bCA9IHggKiB5OwogICAgKm1vZCA9IHggLyB5Owp9