C++ Program to Convert Centigrade to Fahrenheit

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


$F = 32+\frac{9*C}{5}$


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 fahrenheit ($^{\circ}F$) while taking centigrade ($^{\circ}C$) as input.






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

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

#include <iostream>

using namespace std;

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

Output


Enter the temperature in centigrade = 100

Temperature is 212 in fahrenheit When 100 in centigrade.