Here is a C++ program to convert temperature from fahrenheit to celsius degree. In this C++ program to convert temperature from Fahrenheit to Celsius , we will take temperature in fahrenheit as input from user and convert to Celsius and print it on screen. To convert Fahrenheit to Celsius we will use following conversion expression:
Points to Remember
- Celsius is a temperature scale where 0 °C indicates the melting point of ice and 100 °C indicates the steam point of water.
- Fahrenheit temperature scale was introduced around 300 years ago and is currently used in USA and some other countries. The boiling point of water is 212 °F and the freezing point of water is 32 °F.
C++ program to convert temperature from Fahrenheit to Celsius
#include <iostream> using namespace std; int main() { float fahren, celsius; cout << "Enter the temperature in fahrenheit\n"; cin >> fahren; celsius = 5 * (fahren - 32) / 9; cout << fahren <<" Fahrenheit is equal to " << celsius <<" Centigrade"; return 0; }Output
Enter the temperature in fahrenheit 80 80 Fahrenheit is equal to 26.6667 Centigrade
In above program, we first take fahrenheit temperature as input from user. Then convert it to celsius using above conversion equation and print it in screen.
Recommended Posts