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:
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