newb question: probs with this program
my assignment is to write a program that asks for a temperature in fahrenheit, then spits out a value in celsius and kelvin. and ask again for a value in fahrenheit to convert. heres what ive got so far. by the way im using kernhigan and ritchie, with no experience in programming whatsoever. im finding that kernhigan and ritchie is not very good for me.
Code:
#iclude < stdio.h >
#include <math.h >
main()
{
float fahr, celsius, kelvin;
int temp, cels, kelv
temp = ' '
printf("Please enter (in fahr) a temp\n(q to quit)\n");
while (temp != 'q') {
temp = getc ( stdin );
putchar (temp);
cels = (temp-32.0) + (5.0/9.0);
kelv = 273.5 + ((temp - 32.0) + (5.0/9.0));
printf("The temperature in Celsius is %6.1f\n" , cels);
printf("The temperature in Kelvin is %6.1f\n" , kelv);
}
return = 0
}
also, my next assignment is to use the program above (when written correctly) and rewrite it so that it uses one function to conver from fahrenheit to celsius and another to convert from celsius to kelivin. any help would be appreceated