C++ program to enter the temperature in Celsius and convert it into Fahrenheit
ADVERTISEMENTS
C++ program to enter the temperature in Celsius and convert it into Fahrenheit.
There are you will learn how to convert the temperature to Celsius and convert it into Fahrenheit in C++ language.
Formula:
F = (C * 9/5) + 32
Where:
F = fahrenheit
C = celsius
Let us understand this example through the C++ program:
// C++ program to convert temperature from degree Celsius to Fahrenheit
#include <iostream>
using namespace std;
int main() {
float c, f;
// c = celsius
// f = fahrenheit
cout << "Enter the temperature in Celsius::\n";
cin >> c;
/* celsius to fahrenheit conversion formula */
f = (float)((c * 9 / 5) + 32);
// Output
cout << "\n" << c << " Celsius = " << f << " Fahrenheit\n";
return 0;
}
Output:
Enter the temperature in Celsius::
7
7 Celsius = 44.6 Fahrenheit