#include <stdio.h>
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; // 商(小数点以下を切り捨て)
}
int main(void) {
int x = 10, y = 3;
int sum, diff, mul, mod;
cal(x, y, &sum, &diff, &mul, &mod);
printf("%dと%dの和は%d\n", x
, y
, sum
); printf("%dと%dの差は%d\n", x
, y
, diff
); printf("%dと%dの積は%d\n", x
, y
, mul
); printf("%dと%dの商は%d\n", x
, y
, mod
);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIGNhbChpbnQgeCwgaW50IHksIGludCAqc3VtLCBpbnQgKmRpZmYsIGludCAqbXVsLCBpbnQgKm1vZCkgewogICAgKnN1bSA9IHggKyB5OwogICAgKmRpZmYgPSAoeCA+IHkpID8gKHggLSB5KSA6ICh5IC0geCk7ICAvLyDlt67jga7ntbblr77lgKTjgpLmoLzntI0KICAgICptdWwgPSB4ICogeTsKICAgICptb2QgPSB4IC8geTsgIC8vIOWVhu+8iOWwj+aVsOeCueS7peS4i+OCkuWIh+OCiuaNqOOBpu+8iQp9CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgeCA9IDEwLCB5ID0gMzsKICAgIGludCBzdW0sIGRpZmYsIG11bCwgbW9kOwoKICAgIGNhbCh4LCB5LCAmc3VtLCAmZGlmZiwgJm11bCwgJm1vZCk7CgogICAgcHJpbnRmKCIlZOOBqCVk44Gu5ZKM44GvJWRcbiIsIHgsIHksIHN1bSk7CiAgICBwcmludGYoIiVk44GoJWTjga7lt67jga8lZFxuIiwgeCwgeSwgZGlmZik7CiAgICBwcmludGYoIiVk44GoJWTjga7nqY3jga8lZFxuIiwgeCwgeSwgbXVsKTsKICAgIHByaW50ZigiJWTjgaglZOOBruWVhuOBryVkXG4iLCB4LCB5LCBtb2QpOwoKICAgIHJldHVybiAwOwp9Cg==