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.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var