C# Program to Convert Fahrenheit to Centigrade

C# program to convert fahrenheit to centigrade can be implemented by using following formula


$C = \frac{(F-32)*5}{9}$


Here, value of $F$ is the temperature in fahrenheit while $C$ is the temperature in centigrade.

Fahrenheit and Centigrade are two well known temperature scales. Both of them are used regularly in daily temperature measurements. By using above formula, the following C# program produces output in celcius ($^{\circ}C$) while taking fahrenheit ($^{\circ}F$) as input.






1. C# Program & output of to convert fahrenheit to centigrade

Code has been copied
/***********************************************
            alphabetacoder.com
 C# program to convert Fahrenheit to Centigrade
***********************************************/

using System;

namespace FahrenheitToCentigrade
{
    class Program
    {
        static void Main(string[] args)
        {
            // declare variables
            double f,c;
            
            //take input in fahrenheit
            Console.Write("Enter the temperature in fahrenheit = ");
            f = Convert.ToDouble(Console.ReadLine());
            
            //convert fahrenheit to celcius
            c=5*(f-32)/9;
            
            // display result
            Console.WriteLine("Temperature is "+c+" in centigrade When "+f+" in fahrenheit.");

            // wait for user to press any key
            Console.ReadKey();
        }
    }
}

Output


Enter the temperature in fahrenheit = 212

Temperature is 100 in centigrade When 212 in fahrenheit.