C++ Program to Convert Fahrenheit to Celsius

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:

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 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
C++ Program to Convert Temperature from Celsius to Fahrenheit
C++ Program to Convert Decimal Number to Binary Number
C++ Program to Convert Uppercase to Lowercase Characters
C++ Program to Calculate Difference Between Two Time Periods
C++ Program to Convert Decimal Number to Octal Number
C++ Program to Convert Decimal Number to HexaDecimal Number
C++ Program to Find Size of Variables using sizeof Operator
C++ Program to Find LCM and GCD of Two Numbers
C++ Program to Find Quotient and Remainder
All C++ Programs