Each of x and y is a nonnegative integer such that:
x
o Celsius = y
o Fahrenheit
Determine all pairs (x,y) such that x*y is a perfect square, where x < 10
6
**** Celsius to Fahrenheit conversion is given
here.
for fahr=32:9000000/5+32
celsius=(fahr-32)*5/9;
if celsius==floor(celsius)
prod=fahr*celsius;
sr=round(sqrt(prod));
if sr*sr==prod
disp([celsius fahr]);
end
end
end
Celsius Fahrenheit Product Square Root
0 32 0 0
200 392 78400 280
9800 17672 173185600 13160
460800 829472 382220697600 618240
|
Posted by Charlie
on 2022-01-07 09:55:28 |