Convert Temperatures Both Ways
Write the code, see it run, pass the checks.
The problem
- medium
- Code
Two inputs, labelled "Celsius" and "Fahrenheit", stay in step: typing in one fills the other with the converted value (°F = °C × 9 / 5 + 32), rounded to one decimal place, so 100 °C shows 212 and 100 °F shows 37.8. Emptying one empties the other. Keep only what was typed and which scale it was in, and work the other value out from it.
Your code must pass
- Typing Celsius fills in Fahrenheit
- Typing Fahrenheit fills in Celsius, rounded to one decimal
- Emptying one empties the other