Wednesday, May 5, 2021

Javascript Practice 29: JS Hero - Fahrenheit

 
Question: 

Write a function toFahrenheit that converts a temperature from Celsius to Fahrenheit.

Example: toFahrenheit(0) should return 32.




Answer: 

function toFahrenheit (celsius) {

return (celsius * 1.8) + 32; 

};

> Celsius to Fahrenheit formula = (C * 1.8) + 32
> return the above formula in the statement to get the Fahrenheit

No comments:

Post a Comment