Complete the challenge to convert Fahrenheit to Celsius
In this challenge, you'll write code that will use a formula to convert a temperature from degrees Fahrenheit to Celsius. You'll print the result in a formatted message to the user.
Challenge: Calculate Celsius given the current temperature in Fahrenheit
Select all of the code in the .NET Editor, and press Delete or Backspace to delete it.
Enter the following code in the .NET Editor:
int fahrenheit = 94;
To convert temperatures in degrees Fahrenheit to Celsius, first subtract 32, then multiply by five ninths (5 / 9).
Display the result of the temperature conversion in a formatted message
Combine the variables with literal strings passed into a series of
Console.WriteLine()
commands to form the complete message.When you're finished, the message should resemble the following output:
The temperature is 34.444444444444444444444444447 Celsius.
Note
Admittedly, it is preferred to not see so many values after the decimal point. Ideally the value would be formatted to a single value after the decimal point: 34.4
.
Whether you get stuck and need to peek at the solution or you finish successfully, continue to view a solution to this challenge.