Need this Question to be done in C++ only! Thanks! C++ only! 7. Celsius Temperat
ID: 3869844 • Letter: N
Question
Need this Question to be done in C++ only! Thanks!
C++ only!
7. Celsius Temperature Table The formula for converting a temperature from Fahrenheit to Celsius is C = (F - 32) where F is the Fahrenheit temperature and C is the Celsius temperature. Write a fund tion named celsius that accepts a Fahrenheit temperature as an argument. The funce tion should return the temperature, converted to Celsius. Demonstrate the function by calling it in a loop that displays a table of the Fahrenheit temperatures 0 through 20 and their Celsius equivalents.Explanation / Answer
#include <iostream>
using namespace std;
double celsius(int f) {
return ((f - 32) * 5)/9;
}
int main () {// start program
cout<<"Farenheit Celcius0"<<endl;
for(int f=0;f<=20;f++) {
cout<<f<<" "<<celsius(f)<<endl;
}
} // end of program
Output:
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.