In this post, we will write a C# Console program to Convert Fahrenheit to Celsius.
C# Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
class Program { static void Main(string[] args) { double celsius; Console.Write("Enter Fahrenheit temperature : "); double fahrenheit = Convert.ToDouble(Console.ReadLine()); celsius = (fahrenheit - 32) * 5 / 9; Console.WriteLine("Celsius temperature is" + celsius); Console.ReadLine(); } } |
Output:
1 2 3 4 |
Enter Fahrenheit temperature : 158 The converted Celsius temperature is 70 |