C++ Program to Convert Temperature from Celsius to Fahrenheit

Here is a C++ program to convert temperature from celsius to fahrenheit degree. In this C++ program to convert temperature in Celsius to Fahrenheit, we will first take temperature in Celsius scale as input from user and convert to Fahrenheit scale. To convert Celsius to Fahrenheit we will use following conversion expression:

F =(9/5)*C + 32
where, C is the temperature in Celsius and F is temperature in Fahrenheit.
Points to Remember
  • Fahrenheit temperature scale was introduced around 300 years ago, and is currently used in USA and few other countries. The boiling point of water is 212 °F and the freezing point of water is 32 °F.
  • Celsius is a temperature scale where 0 °C indicates the melting point of ice and 100 °C indicates the steam point of water.

C++ Program to Convert Temperature from Celsius to Fahrenheit Scale

#include <iostream>
using namespace std;
 
int main() {
    float fahren, celsius;
 
    cout << "Enter the temperature in celsius\n";
    cin >> celsius;
 
    // convert celsius to fahreneheit 
    // Multiply by 9, then divide by 5, then add 32
    fahren =(9.0/5.0) * celsius + 32;
 
    cout << celsius <<"Centigrade is equal to " << fahren 
        <<"Fahrenheit";
     
    return 0;
}
Output
Enter the temperature in celsius
40
40 Centigrade is equal to 104 Fahrenheit

In above program, we first take Celsius temperature as input from user. Then convert it to Fahrenheit using above conversion equation and print it in screen using cout.


Recommended Posts
C++ Program to Convert Fahrenheit to Celsius
C++ Program to Convert Decimal Number to Binary Number
C++ Program to Convert Decimal Number to Octal Number
C++ Program to Convert Decimal Number to HexaDecimal Number
C++ Program to Convert Uppercase to Lowercase Characters
C++ Program to Calculate Difference Between Two Time Periods
C++ Program to Add Two Distances in Inch and Feet
C++ Program to Make a Simple Calculator
C++ Program to Find LCM and GCD of Two Numbers
C++ Program to Find Quotient and Remainder
C++ Program to Find Size of Variables using sizeof Operator
All C++ Programs