# C# program to convert a temperature from Fahrenheit into Celsius

Here, we are going to learn how to convert a temperature from Fahrenheit into Celsius in C#?
Submitted by Nidhi, on September 14, 2020

Here we will read the temperature in Fahrenheit and then convert it into the corresponding temperature Celsius.

Program:

The source code to convert a Fahrenheit temperature into Celsius is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

```//C# program to convert a Fahrenheit temperature into Celsius.

using System;

class Program
{
static double convertToCelsius(double ferTemp)
{
double cTemp = 0;

cTemp = (ferTemp - 32) * 5 / 9;
return cTemp;
}
static void Main(string[] args)
{
double celTemp=0;
double ferTemp=0;

Console.Write("Enter the value of temperature in Fahrenheite(°F): ");

celTemp = convertToCelsius(ferTemp);
Console.WriteLine("Celsius temperature is(°C) : " + celTemp);
}
}
```

Output:

```Enter the value of temperature in Fahrenheite(°F): 90.5
Celsius temperature is(°C) : 32.5
Press any key to continue . . .
```

Explanation:

In the above program, we created a class Program that contains two static methods convertToCelsius() and Main(). The convertToCelsius() method is used to convert the Fahrenheit temperature into Celsius.

In the Main() method, we read the value of temperature in Fahrenheit and then convert the temperature into Celsius using convertToCelsius() method and print the result on the console screen.

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates