Written by Siddartha Thota on March 17, 2013 in C# > Programming

C# Program to Convert temperature from Fahrenheit to Celsius

GET ALERTS:

Get our Latest updates delivered to your mailbox!

In this program, we are going to convert the temperature which you must define in Fahrenheit to Celsius. We are using C# console application in order to convert it. We can also use the Windows Forms or Web Applications to do it, the logic will be same, but you need to create the button events and labels to convert it. It is pretty simple program which can be done by using the single line logic celsius = (fahrenheit - 32) * 5 / 9; as you need to subtract Fahrenheit with 32 and then multiply the result with 5 and divide it 9, in order to convert it.

So, let us check out a C# Program to Convert temperature from Fahrenheit to Celsius.

Open Visual Studio 2010 or 2012. As we are using the Console Application, make sure you select Console Application after selecting the New Project.

Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace fartocelc
{
    class Program
    {
        static void Main(string[] args)
        {

            double celsius;
            Console.WriteLine("Enter the temperature to convert from Fahrenheit to Celsius");
            double fahrenheit = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("The entered Farenheit temperature is: " + fahrenheit); \\logic
            celsius = (fahrenheit - 32) * 5 / 9;
            Console.WriteLine("The converted temperature is" + celsius + " degrees Celsius");
        }
    }
}
 

OutPut :
C# program to convert farenheit to celsius

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: