Read the question, write JavaScript on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
Read a Celsius temperature (it may have decimals) and log it in Fahrenheit.
F = C × 9/5 + 32. Log the result with exactly one digit after the decimal point.
Input. One line: a number.
Output. Fahrenheit to one decimal, e.g. 98.6
Constraints
- -273.15 ≤ C ≤ 1000
Examples
Input
37
Output
98.6
Input
100
Output
212.0
Hint
- JavaScript division is already floating-point: 9 / 5 is 1.8.
- Number.prototype.toFixed(1) rounds and formats: (value).toFixed(1).
Show correct code
Peek only after you have tried. You can still Check your own version.
const c = Number(readLine());
console.log((c * 9 / 5 + 32).toFixed(1));
main.jsconsole.log · readLine() · Ctrl + Enter
ResultIdle
Run to see output. Check grades the tests.