# Thread: please compile my C program and help with my errors

1. ## please compile my C program and help with my errors

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 three functions in my program.

Function celciusAtDepth should compute and return the Celsius temperature at a depth measured in kilometers.

Function celsiusToFahrenheit should convert a Celcius temperature to Fahrenheit.

Function printResults should take in the two temperatures and print them.

Note: all the function inputs should be done in main and the all the outputs shoud be done in printResults.

I also don't want my results to be (celsius, fahrenheit) on the same line. I want celsius answer in one line and fahrenheit answer in another line. thank you.
Code:
```#include <stdio.h>

/* Function Declaration */
double celsiusAtDepth;
double celsiusToFahrenheit;
void printResults;

int main()
{
double depth;
printf("Enter a depth value: ");
scanf("&#37;lf", &depth);

double celsius=celsuisAtDepth;
double fahrenheit=celsiusToFahrenheit(celsius);
PrintResults(celsius, fahrenheit);

return (0);
}
/* Celsius=10*depth=20 */
double celsiusAtDepth (double depth)
{
return(10*depth+20);
}
/*Fahrenheit=((9.0/5.0)*celsius+32) */
double celsiusToFahrenheit (double celsius)
{
return((9.0/5.0)*celsius+32);
}
/*Function printResults should take in the two temperatures and print them. */
void printResults (double celsius, double fahrenheit)
{
printf("Celsius: %lf\nFahrenheit: %lf\n", celsius, fahrenheit);
}```
I run the compiler gcc, so it looks like this: gcc -Wall -ansi -pedantic -file name
I got of lot of errors.

2. 1. This is the C# forum.

2. You aren't passing your depth value to celsiusAtDepth()

3. The error message(s) will tell you what and (more conveniently) where the errors are located, so you can track them down easily.

4. Code:
```/* Function Declaration */
double celsiusAtDepth;
double celsiusToFahrenheit;
void printResults;```
No, it is not...
Code:
`double celsiusAtDepth (double depth); /* this IS function declaration */`

5. Function declarations are incorrect.
Incorrect calling of functions.