C++ Program to Convert Fahrenheit to Centigrade

C++ program to convert fahrenheit to centigrade can be implemented by using following formula


$C = \frac{(F-32)*5}{9}$


Here, value of $F$ is the temperature in fahrenheit while $C$ is the temperature in centigrade.

Fahrenheit and Centigrade are two well known temperature scales. Both of them are used regularly in daily temperature measurements. By using above formula, the following C++ program produces output in celcius ($^{\circ}C$) while taking fahrenheit ($^{\circ}F$) as input.






1. C++ Program & output to convert fahrenheit to centigrade

Code has been copied
/***********************************************
            alphabetacoder.com
 C++ program to convert Fahrenheit to Centigrade
***********************************************/

#include <iostream>

using namespace std;

int main()
{
    // declare variables
    double f,c;
	
    //take input in fahrenheit
    cout<<"Enter the temperature in fahrenheit = ";
    cin>>f;
    
    //convert fahrenheit to celcius
    c=5*(f-32)/9;
    
    // display result
    cout<<"Temperature is "<<c<<" in centigrade When "<<f<<" in fahrenheit.";
    return 0;
}

Output


Enter the temperature in fahrenheit = 212

Temperature is 100 in centigrade When 212 in fahrenheit.