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

  1. Select all of the code in the .NET Editor, and press Delete or Backspace to delete it.
  2. Enter the following code in the .NET Editor:C#Copyint fahrenheit = 94;
  3. To convert temperatures in degrees Fahrenheit to Celsius, first subtract 32, then multiply by five ninths (5 / 9).
  4. Display the result of the temperature conversion in a formatted messageCombine the variables with literal strings passed into a series of Console.WriteLine() commands to form the complete message.
  5. When you’re finished, the message should resemble the following output:OutputCopyThe 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.

php and mysql training courses malaysia

Leave a Reply

Your email address will not be published. Required fields are marked *