;

C# Program to Perform Fahrenheit to Celsius Conversion


Tutorialsrack 28/01/2020 C# Programs

In this C program, we will learn how to write a program to perform the conversion from Fahrenheit to Celsius. 

How to Convert Temperature from Fahrenheit to Celsius?

0 °F = -17.77778 °C

The Formula is used for Converting temperature from Fahrenheit to Celsius is as follows:

T(°C) = (T(°F) - 32) × 5/9

or

T(°C) = (T(°F) - 32) / (9/5)

or

T(°C) = (T(°F) - 32) / 1.8

Where, T = Temperature,

          °F = Fahrenheit,

          °C = Celsius

Here is the code of the program to program to perform the conversion from Fahrenheit to Celsius.

C# Program To Convert Fahrenheit to Celsius
using System;

namespace Tutorialsrack
{
    class Program
    {
        /* C# Program to Perform Fahrenheit to Celsius Conversion */
        static void Main(string[] args)
        {
            decimal Temperature_in_Fahrenheit, Celsius;
            Console.Write("Enter the Temperature in Fahrenheit(°F) : ");
            Temperature_in_Fahrenheit = decimal.Parse(Console.ReadLine());
            Celsius = (Temperature_in_Fahrenheit - 32) * 5 / 9;
            Console.WriteLine("{0} °F Temperature in Celsius is(°C) : {1}", Temperature_in_Fahrenheit, Celsius);

            //Hit ENTER to exit the program
            Console.ReadKey();
        }
    }
}
Output

Enter the Temperature in Fahrenheit(°F) : 98.6

98.6 °F Temperature in Celsius is(°C) : 37.0


Related Posts



Comments

Recent Posts
Tags