Kat H.

asked • 05/04/21

C To F. Write a function: double celsiusToFahrenheit(double celsius)

Write a function:

double celsiusToFahrenheit(double celsius)


It should return the Fahrenheit temperature equivalent to the given Celsius temp.

F = (9.0 / 5) * C + 32


Code:


#include <iostream>

#include <iomanip>

using namespace std;

//Do not modify anything on or above the line below this

//YOUR_CODE_BELOW


//YOUR_FUNCTION HERE


//YOUR_CODE_ABOVE

//Do not modify anything on or below the line above this


int main()

{

cout << fixed << setprecision(1);

double t1 = celsiusToFahrenheit(40);

cout << t1 << endl;

double t2 = celsiusToFahrenheit(32.0);

cout << t2 << endl;

}

1 Expert Answer

By:

Patrick B. answered • 05/04/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.