diff options
| author | phoebos <ben@bvnf.space> | 2021-06-21 11:46:40 +0100 |
|---|---|---|
| committer | phoebos <ben@bvnf.space> | 2021-06-21 11:46:40 +0100 |
| commit | fb8250fa0c3f6d1f052d36219ad5e3fa0852b4d4 (patch) | |
| tree | f7a3f1bb08880c4267c776bfff4434aa80feb754 | |
| parent | 68cd61de0e2d5bfb3f46d6c3a00cf29320ad2d56 (diff) | |
| download | kandr-master.tar.gz | |
| -rw-r--r-- | 1.2.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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; +} |