- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Program to Convert Fahrenheit to Celsius
Firstly, set the Fahrenheit temperature −
double fahrenheit = 97; Console.WriteLine("Fahrenheit: " + fahrenheit);
Now convert it into Celsius −
celsius = (fahrenheit - 32) * 5 / 9;
Example
You can try to run the following code to convert Fahrenheit to Celsius.
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Demo { class MyApplication { static void Main(string[] args) { double celsius; double fahrenheit = 97; Console.WriteLine("Fahrenheit: " + fahrenheit); celsius = (fahrenheit - 32) * 5 / 9; Console.WriteLine("Celsius: " + celsius); Console.ReadLine(); } } }
Output
Fahrenheit: 97 Celsius: 36.1111111111111
Advertisements