C++ Program to Convert Fahrenheit to Celsius

  • Write 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:

C = (F - 32)*(5/9)
where, F is temperature in fahrenheit and C is temperature in celsius.
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 is currently used in US. 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

// C++ program to convert temperature from fahrenheit to celcius

#include <iostream>
using namespace std;
 
int main() {
    float fahren, celsius;
 
    cout << "Enter the temperature in fahrenheit\n";
    cin >> fahren;
 
    // convert fahreneheit to celsius 
    // Subtract 32, then multiply it by 5, then divide by 9
    
    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.