#include <stdio.h>
/*
main関数内で6つの整数x、y、sum、diff、mul、modを定義しなさい。
そして、sum、diff、mul、modのアドレスを指すポインタ変数を使って
x, yの和,差,積、商をそれぞれ格納する以下の関数calを作成し、
main関数内で各計算結果を表示しなさい。
ただし、関数内で計算される差の結果は必ず正の整数として格納すること。
また、商の計算結果は小数点以下を切り捨てとすること。
void cal(int x, int y, int *sum, int *diff, int *mul, int *mod)
*/
void cal(int x, int y, int *sum, int *diff, int *mul, int *mod){
*sum = x+y;
if(x>y) *diff = x-y;
else *diff = y-x;
*mul = x*y;
if(y!=0) *mod = x/y;
else *mod = 0;
}
int main(void) {
int x=3;
int y=5;
int sum, diff, mul, mod;
cal(x,y,&sum,&diff,&mul,&mod);
printf("x = %d, y = %d, sum = %d, diff = %d, mul = %d, mod = %d",x
,y
,sum
,diff
,mul
,mod
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgovKgoJbWFpbumWouaVsOWGheOBp++8luOBpOOBruaVtOaVsHjjgIF544CBc3Vt44CBZGlmZuOAgW11bOOAgW1vZOOCkuWumue+qeOBl+OBquOBleOBhOOAggoJ44Gd44GX44Gm44CBc3Vt44CBZGlmZuOAgW11bOOAgW1vZOOBruOCouODieODrOOCueOCkuaMh+OBmeODneOCpOODs+OCv+WkieaVsOOCkuS9v+OBo+OBpgoJeCwgeeOBruWSjO+8jOW3ru+8jOepjeOAgeWVhuOCkuOBneOCjOOBnuOCjOagvOe0jeOBmeOCi+S7peS4i+OBrumWouaVsGNhbOOCkuS9nOaIkOOBl+OAgQoJbWFpbumWouaVsOWGheOBp+WQhOioiOeul+e1kOaenOOCkuihqOekuuOBl+OBquOBleOBhOOAggoJ44Gf44Gg44GX44CB6Zai5pWw5YaF44Gn6KiI566X44GV44KM44KL5beu44Gu57WQ5p6c44Gv5b+F44Ga5q2j44Gu5pW05pWw44Go44GX44Gm5qC857SN44GZ44KL44GT44Go44CCCgnjgb7jgZ/jgIHllYbjga7oqIjnrpfntZDmnpzjga/ls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