C# program to convert fahrenheit to celsius

Views: 73   

Following program shows you how to convert fahrenheit to celsius.
In this program we get fahrenheit temperature from user and convert that fahrenheit temperature into celsius using following formula
Celsius = (fahrenheit - 32) * 5 / 9

using System;

class MainClass {
    public static void Main (string[] args) {
    Console.WriteLine ("Please enter temperature in fahrenheit:");
    double temperature = Convert.ToDouble(Console.ReadLine());
    double celsius = (temperature - 32) * 5 / 9;
    Console.WriteLine("Temperature in celsius: " + celsius);
  }
}

Output:

Please enter temperature in fahrenheit:
 54
Temperature in celsius: 12.2222222222222
On By