converts the temperature in Fahrenheit to Celsius - CSharp Language Basics

CSharp examples for Language Basics:double

Description

converts the temperature in Fahrenheit to Celsius

Demo Code

using System;//from   w w w.ja v a2s.c o m
public class Program
{
   public static int Main(string[] args)
   {
      Console.Write("Enter temp in degrees Fahrenheit:");
      string fahrInput = Console.ReadLine();
      double fahr = Convert.ToDouble(fahrInput);
      // Convert that temperature into degrees Celsius.
      double celsius = (fahr - 32.0) * (5.0 / 9.0);
      Console.WriteLine("Temperature in degrees Celsius = " + celsius);
      return 0;
   }
}

Result


Related Tutorials