Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that takes as input a depth (in kilometers) inside the earth and

ID: 3549487 • Letter: W

Question

Write a program that takes as input a depth (in kilometers) inside the earth and displays the temperature at this depth in degrees Celsius and in degrees Fahrenheit. The relevant formula is

C=10d+20

where C is the temperature in degrees Celsius and d is the depth in kilometers (a positive number). The temperature in degrees Fahrenheit is given by F=(9/5)C+32

Your program should include two functions. Function celsius_at_depth should compute and return the Celsius temperature at a depth given in kilometers. Function fahrenheit should convert a Celsius temperature to Fahrenheit.
Your program should interact with the user in exactly this manner:


Explanation / Answer

#include <stdio.h>

float toCelcius(float tmp)
{

float c = 10*tmp + 20;

return c;
}

float toFahren(float tmp)
{
float c = toCelcius(tmp);
float j = (c*(9/5)) +32;
return j;
}



int main()
{
float depth =0.0;

printf("Enter Depth in KM:");
scanf("%f",&depth);

printf("Earth's temp in Celcius is : %f ",toCelcius(depth));
printf("Earth's temp in Fahreinheit is : %f ",toFahren(depth));
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote