First, set the temperature in Fahrenheit -
double fahrenheit = 97; Console.WriteLine("Fahrenheit: " + fahrenheit);
Now convert it to Celsius -
celsius = (fahrenheit - 32) * 5 / 9;
You You can try running the following code to convert Fahrenheit to Celsius.
Live Demo
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Demo { class MyApplication { static void Main(string[] args) { double celsius; double fahrenheit = 97; Console.WriteLine("Fahrenheit: " + fahrenheit); celsius = (fahrenheit - 32) * 5 / 9; Console.WriteLine("Celsius: " + celsius); Console.ReadLine(); } } }
Fahrenheit: 97 Celsius: 36.1111111111111
The above is the detailed content of C# program to convert Fahrenheit to Celsius. For more information, please follow other related articles on the PHP Chinese website!