Determine all possible pairs (x,y) of
nonzero integers that satisfy this equation:
(x/y)oC = (x-y)oF
Note:
oF = (9/5)*
oC+32, where
oF represents degrees Fahrenheit and,
oC represents degrees Celsius.
clearvars,clc
for y=-10000:10000
for x=y-10000:y+10000
c=x/y; f=x-y;
if 9*c/5+32==f
fprintf('%3d %3d %11.6f %11.6f\n',x, y, c, f)
end
end
end
finds
x y C F
0 -32 -0.000000 32.000000
20 -6 -3.333333 26.000000
340 2 170.000000 338.000000
340 306 1.111111 34.000000
Just ignore the first line as it violates the nonzero nature expected of x.
|
Posted by Charlie
on 2022-10-01 12:35:19 |