Answer to Question #159425 in C++ for Earl

Question #159425

You will be converting the current temperature from Fahrenheit to Celsius. To convert to Celsius (C), subtract 32 from the user's number, then multiply by 5 and divide by 9. This exercise is testing your mastery of operator precedence (order of operations). 

 

Output:

Enter the current outdoor temperature in Fahrenheit:   [assume user inputs 80]

It is 26.6667 degrees Celsius outside.


1
Expert's answer
2021-01-29T18:38:50-0500

// Converting the current temperature from Fahrenheit to Celsius

// the preprocessing directives

#include <iostream>            // cin, cout

 

using namespace std;

 

int main()

{

 // declare the variables

 double Fahr, Cels;

 

 

 cout << "Enter the current outdoor temperature in Fahrenheit: ";

 cin>>Fahr;

 

 Cels = (Fahr-32)*5/9;

 cout<<"It is "<<Cels<<" degrees Celsius outside."<<endl;

 

   return 0;

}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog