diff options
Diffstat (limited to '1.2.c')
-rw-r--r-- | 1.2.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/1.2.c b/1.2.c index 9614161..f68573f 100644 --- a/1.2.c +++ b/1.2.c @@ -5,6 +5,8 @@ #define UPPER 300 #define STEP 20 +float fahr_to_cel (float fahr); + int main() { float fahr; size_t fahrs; @@ -16,8 +18,12 @@ int main() { printf("%3s\t%6s\n", "F", "C"); for (fahr=UPPER; fahr >= LOWER; fahr -= STEP) { - printf("%3.0f\t%6.2f\n", fahr, 5. * (fahr - 32.) / 9.); + printf("%3.0f\t%6.2f\n", fahr, fahr_to_cel(fahr)); } free(fahrp); return 0; } + +float fahr_to_cel (float fahr) { + return 5.0 * (fahr - 32.0) / 9.0; +} |