All challenges
ProgrammingWrite codeBeginner5 min
Convert a temperature
Skills: Functions · Operators
Task
Write toFahrenheit(celsius), which converts degrees Celsius to degrees Fahrenheit with the formula F = C × 9 / 5 + 32.
Decimal results count as equal when they differ by less than 0.000000001.
Examples
Run examples tries these. Check solution also runs 3 more tests.
- Water freezes at 32 °FExample
- Call
- toFahrenheit(0)
- Expected
- Returns 32
- Water boils at 212 °FExample
- Call
- toFahrenheit(100)
- Expected
- Returns 212
Every test, including the extra ones, is part of this page. Nothing is hidden or secret.
Your code
Loading the editor…
function toFahrenheit(celsius) {
}
Ctrl + Enter (⌘ + Enter on a Mac) runs the examples; add Shift to check. Tab indents; press Esc, then Tab, to leave the editor.
Run examples tries your code on the examples and records nothing. Check solution runs every test and saves an attempt.
Tests
Run your code to see which tests pass.
Console
What your code logs with console.log appears here.