All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Temperature Reflection (Posted on 2003-09-29)
On my way to work, I pass by a digital thermometer outside a bank that displays the temperature to the nearest integer, alternating back and forth between Fahrenheit and Celsius at four-second intervals.

The other day, when I was going to work, I noticed that the temperatures displayed in Fahrenheit and Celsius were simply reverse digits of each other.

Well, it warmed up nicely during the day, and when I was on my way home, I looked at the same thermometer.
Imagine my shock when, again, the Fahrenheit and Celsius temperature displays were simply reversed digits of each other!

What was the temperature when I came in to work, and what was it when I was on my way home?

Note: To convert from degrees Fahrenheit to Celsius, subtract 32 then multiply by 5/9. To convert the other way, simply do the opposite (multiply by 9/5 and add 32). Ignore leading zeroes.

 See The Solution Submitted by DJ Rating: 4.2308 (13 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Javascript Comment 10 of 10 |

Knowing the solution would be a two digit number, and recognizing that all positive Celsius values are less than their Fahrenheit counterpart, the javascript may have been more efficiently written as follows:

for (var c=11; c<100; c++) {
x=Math.floor(c/10);
y=c%10;
f=Math.round((c*9/5)+32);
f2=10*y+x;
if (f==f2)
document.write(f + ", " + c + "<br>");
}

By beginning at c=11, the returning of a one-digit value is eliminated.

 Posted by Dej Mar on 2006-02-26 22:26:08

 Search: Search body:
Forums (7)