We appreciate your visit to 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. This page offers clear insights and highlights the essential aspects of the topic. Our goal is to provide a helpful and engaging learning experience. Explore the content and find the answers you need!
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
Thanks for taking the time to read 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. We hope the insights shared have been valuable and enhanced your understanding of the topic. Don�t hesitate to browse our website for more informative and engaging content!
- Why do Businesses Exist Why does Starbucks Exist What Service does Starbucks Provide Really what is their product.
- The pattern of numbers below is an arithmetic sequence tex 14 24 34 44 54 ldots tex Which statement describes the recursive function used to..
- Morgan felt the need to streamline Edison Electric What changes did Morgan make.
Rewritten by : Barada