I need help fixing my program that I have attached hereCode:/* Alfredo Perez */ /* earth.c */ /* A program that takes depth in KM inside of earth and displays the temperature at this depth in degrees Celsius and degrees Fahrenheit */ #include <stdio.h> /* Function Declaration */ double celsius_at_depth(double depth); double fahrenheit(double celsius_at_depth); int main() { double depth; double celsius_at_depth; double fahrenheit; print("Enter depth in kilometers => "); scanf("%lf", &depth); printf("The temperature is %.0f degrees C or %.1F degrees F.\n", celsius_at_depth, fahrenheit); return (0); } /* Compute celsius with given depth */ double celsius_at_depth(double depth) { return (10*depth+20); } /* Convert Celsius to Fahrenheit */ double fahrenheit(double celsius_at_depth) { return ((9.0/5.0)*celsius_at_depth+32); }
I do not get the values that I want when I run the program. The problem is:
I have to 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 Celsius and degrees Fahrenheit. So basically, when I compile my program, it should allow me to enter the depth value first. The relevant formulas are:
Celsius = 10 * depth + 20
Fahrenheit = 9/5 * Celcius + 32
I have to include two functions in my program.
Function celcius_at_depth should compute and return the Celsius temperature at a depth measured in kilometers.
Function fahrenheit should convert a Celcius temperature to Fahrenheit.