If someone could help me with this code I would be very greatful.
I need to get the depth value out of the main function so i can use it in the function celcius_at_depth. and then how would i get the celcius value into the farenheight function? Thank you.
Explanation: This program takes a depth(in kilometers) inside the
earth as input data and then computes and displays the temperature
at this depth for Celcius and Ferenheight.
1. Explain program to user.
2. Take in data from file depth.txt
3. Calculate the data.
4. Output the data to temperature.txt
include files used <stdio.h>
double celcius, farenheight, depth;
FILE *inp, /* pointer to input file */
*outp; /* pointer to output file */
inp = fopen("depth.txt", "r");
outp = fopen("temperature.txt", "w");
/* Explain program */
printf("This program takes a depth(in kilometers)\n"
"inside the earth as input data and then \n"
"computes and displays the temperature\n"
"at this depth for Celcius and Ferenheight\n"
"Input is collected from a text file and is written\n"
"to a text file.\n");
fscanf(inp, "%lf", &depth);
void celcius_at_depth(double celcius)
return 10 * depth +20;
void farenheight(double farenheight)
return 1.8 * celcius + 32;