# Homework: Converting Temperature (F to K)

This is a discussion on Homework: Converting Temperature (F to K) within the C Programming forums, part of the General Programming Boards category; Hey everyone! I am rushing to finish my last Cprogramming homework question. However i am not that familiar with Calling ...

1. ## Homework: Converting Temperature (F to K)

Hey everyone! I am rushing to finish my last Cprogramming homework question. However i am not that familiar with Calling functions and i was wondering if u guys can check out my program and educate me on what errors i made. (I know I should read up on this kind of stuff but i just have no time today) So please any help would be greatly appreciated. Thanks!

Code:
```#include <stdio.h>
#include <math.h>

int main (void)
{

float a[6], b[6], p;

FILE *input;
FILE *output;
input = fopen("a7q2.in","r");
output= fopen("a7q1.out","w");

k[i]=temp_conv(float a[i], k[i], numbers);	  	  	  	  	  	  	  //Converting F to K

print2(float a[i], k[i];								 	 	 //Printing to screen and

}

{
fscanf(input,"%f",&a[i]);
}

int temp_conv(float a[i], k[i], numbers)

{
for (i=0, i<20, i++)
{

if (i=0)
{
numbers=a[i]
}

else if (i>0 && i<20)
{
k[i]=(a[i]-32)*(5/9)+273.15
}
}

print2(float a[i], k[i])

{
printf("The total number of the temperatures is: %f"
"Temp (F)		Temp (K)"
"%.2f			%.2f", numbers, a[i], k[i]);

fprintf(outfile,"The total number of the temperatures is: %f"
"Temp (F)	 	 Temp (K)"
"%.2f	 	 	 %.2f", numbers, a[i], k[i]);
}```
please retain format as much as possible

2. Dude - function prototypes - use them. You are not supposed to call a function before it is defined.

And be sure you use proper return types - if you don't want the function to return a value (ie, you want it to just do something and not return a value to the caller), use a void return type. Otherwise, you need to use the return statement.

You need to check out your for statements too - gotta be careful you don't type a comma instead of a semi-colon.

There is more, but this should get you started.

If you get more help than what I have given you here, you are doing well. A lot of people on here get somewhat annoyed when people want a rush fix up job on a rushed homework assignment. Maybe a poor mark would be enough motivation to start it earlier next time. That said, good luck on figuring out your bugs.

~/