Program to convert temperature from Fahrenheit to Centigrade

Q. Write a C++ program to convert temperature from Fahrenheit to Centigrade using function.

Answer:

Following program is converting temperature from Fahrenheit to Centigrade.

#include<iostream>
using namespace std;
float convert(float);
int main()
{
        float fah, cel;
        cout<<"\n Enter Temperature in Fahrenheit : ";
        cin>>fah;
        cel=convert(fah);
        cout<<"\n Temperature in Celsius : "<<cel;
        return 0;
}
float convert(float fah)
{
        return ((fah-32) / 1.8);
}


Output:

fahrenheit to centigrade