Convert Fahrenheit to Celsius in CSharp
Description
The following code shows how to convert Fahrenheit to Celsius.
Example
using System; /*from w w w. j a va 2 s. c o m*/
public class FtoC {
public static void Main() {
double f; // holds the temperature in Fahrenheit
double c; // holds the temparture in Celsius
f = 123.0; // start with 59 degrees Fahrenheit
c = 5.0 / 9.0 * (f - 32.0); // convert to Celsius
Console.Write(f + " degrees Fahrenheit is ");
Console.WriteLine(c + " degrees Celsius.");
}
}
The code above generates the following result.