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

(please run your program before submitted) It is absolutely crucial to end all o

ID: 3628605 • Letter: #

Question

(please run your program before submitted)

It is absolutely crucial to end all of your programs with:


return 0;

as the last line before the closing '}' bracket in your main function.
Programs that do not follow this convention will not be graded correctly.
Programs that end with that line may still fail because they do not
generate the right output.


Each sample run is indicated by a line of "=" symbols. These lines only indicate
the start and the end of a sample run and should not be printed by
your program.

Use 64-bit floating point numbers (i.e., double) for all floating
point calculations. Do not use float as your results may differ from the test cases
due to small precision errors.

(ADD system ("pause");   and retunr 0; at the end)

Problem 7
#########

Write a program to take a depth (in kilometers) inside the earth as
input data; compute and display the temperature at this depth in
degrees Fahrenheit. The relevant formulas are:

Celsius = 10 (depth) + 20 (Celsius temperature at depth in km)
Fahrenheit = 1.8 (Celsius) + 32

Remarks: Please replicate the exact text of the prompts and the
output. Make sure that the answer is printed with two digit precision
(i.e., "%.2f" in printf). Even though the text must be the same, the
numbers may be different depending on the user input.

============= START OF SAMPLE RUN =======================
Enter the depth inside the earth in kilometers:
2.0
The temperature is 40.00 degrees Celsius or 104.00 degrees Fahrenheit.
============= END OF SAMPLE RUN =======================

Explanation / Answer

#include <stdio.h>

#include<stdlib.h>

int main()

{

double a;

double c,f;

printf( "============= START OF SAMPLE RUN ======================= ");

printf(" Enter the depth inside the earth in kilometers:");

scanf("%lf",&a);

c = 10*a+20;

f = 1.8*c+32;

printf( " The temperature is %.2lf degrees Celsius or %.2lf degrees Fahrenheit",c,f);

system("pause");

return 0;

}