High School

Write a program in C++ to input a temperature in Fahrenheit, convert it to Celsius, and display the result.

Sample Output:
```
Convert temperature in Fahrenheit to Celsius:
Input the temperature in Fahrenheit: 95
The temperature in Fahrenheit: 95
The temperature in Celsius: 35
```

Answer :

Here's a C++ program that takes a temperature in Fahrenheit as input, converts it to Celsius, and displays the result:

```cpp
#include
using namespace std;

int main() {
float fahrenheit, celsius;

cout << "Convert temperature in Fahrenheit to Celsius:" << endl;
cout << "Input the temperature in Fahrenheit: ";
cin >> fahrenheit;

// Convert Fahrenheit to Celsius using the formula (F - 32) * 5/9
celsius = (fahrenheit - 32) * 5 / 9;

cout << "The temperature in Fahrenheit: " << fahrenheit << endl;
cout << "The temperature in Celsius: " << celsius << endl;

return 0;
}
```

In this program, we first declare two variables: `fahrenheit` and `celsius`, both of type `float`. The `cout` statements prompt the user to input the temperature in Fahrenheit, and the `cin` statement stores the input value in the `fahrenheit` variable.

We then use the formula `(F - 32) * 5/9` to convert the temperature from Fahrenheit to Celsius, where `F` represents the temperature in Fahrenheit. The resulting Celsius value is stored in the `celsius` variable.

Finally, we use `cout` statements to display the input temperature in Fahrenheit and the converted temperature in Celsius.

When we run the program and provide an input of 95 Fahrenheit, it will output:

```
Convert temperature in Fahrenheit to Celsius:
Input the temperature in Fahrenheit: 95
The temperature in Fahrenheit: 95
The temperature in Celsius: 35
```

Learn more about Fahrenheit :

https://brainly.com/question/516840

#SPJ11