#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 = 3, y = 5;
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+8iQp9CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgeCA9IDMsIHkgPSA1OwogICAgaW50IHN1bSwgZGlmZiwgbXVsLCBtb2Q7CgogICAgY2FsKHgsIHksICZzdW0sICZkaWZmLCAmbXVsLCAmbW9kKTsKCiAgICBwcmludGYoIiVk44GoJWTjga7lkozjga8lZFxuIiwgeCwgeSwgc3VtKTsKICAgIHByaW50ZigiJWTjgaglZOOBruW3ruOBryVkXG4iLCB4LCB5LCBkaWZmKTsKICAgIHByaW50ZigiJWTjgaglZOOBruepjeOBryVkXG4iLCB4LCB5LCBtdWwpOwogICAgcHJpbnRmKCIlZOOBqCVk44Gu5ZWG44GvJWRcbiIsIHgsIHksIG1vZCk7CgogICAgcmV0dXJuIDA7Cn0K