Select Page

Task of Challenge #09/54

Create a function that will convert from Fahrenheit to Celsius. Convert -38 degree Fahrenheit.

Solution

Explanation

How to convert Celsius to Fahrenheit

The temperature T in degrees Fahrenheit (°F) is equal to the temperature T in degrees Celsius (°C) times 9/5 plus 32:

T(°F) = T(°C) × 9/5 + 32

or

T(°F) = T(°C) × 1.8 + 32

Example

Convert 20 degrees Celsius to degrees Fahrenheit:

T(°F) = 20°C × 9/5 + 32 = 68 °F

To accomplish our task, we need to reverse the conversion of degrees to Fahrenheit. This means we first subtract 32 and then divide by 1.8.

This is done in the convertFahrenheitToCelsius-function.

Just return the number and print it out, and you are done!

The console prints out -38.888888888888886 when we put in the number -38.

Because this is the point where Celsius and Fahrenheit have the same amount.

Follow me on Instagram and don’t miss the latest Challenge!

https://www.instagram.com/arnold.code/

Become a bullet proof developer and seek my coding adventures on Udemy

https://www.udemy.com/user/arnold-abraham-3/

Don’t miss two of my most read Medium Articles