c functions and calls - 04/20/04 10:04 AM
hello,
please take a look at the following code and give me some feedback on
1. does it reflect "good programming style"
2. is it "portable"
3. is it "elegant"
i am learning this c language and would love feedback.
so far you guys have been a great help. i want to get up to speed on this programming stuff asap. i got a graphlink for my ti - 83+ graphing calc and wanna get into some assembly with it .. but thats a whole other topic ....
so heres the code ...
please take a look at the following code and give me some feedback on
1. does it reflect "good programming style"
2. is it "portable"
3. is it "elegant"
i am learning this c language and would love feedback.
so far you guys have been a great help. i want to get up to speed on this programming stuff asap. i got a graphlink for my ti - 83+ graphing calc and wanna get into some assembly with it .. but thats a whole other topic ....
so heres the code ...
Code
float celsius_conversion(float fahr); float kelvin_conversion(float celsius); float fahr, celsius, kelvin; int main(void) { printf ("\nPlease enter the temperature in Farenheit\n"); printf ("that you wish to convert to Celsius and Kelvin: "); scanf (" %f", &fahr); celsius = celsius_conversion(fahr); printf("\n%.1f Degrees Farenheit is:\n\n1. %.1f Degrees Celsius\n2. %.1f Kelvin", fahr, celsius_conversion(fahr), kelvin_conversion(celsius)); return 0; } float celsius_conversion(float fahr) { celsius = (5 * (fahr -32)/9); return celsius; } float kelvin_conversion(float celsius) { kelvin = celsius + 273.15; return kelvin; }