C/Fahr-to-Celc.c

21 lines
368 B
C
Raw Normal View History

2024-05-13 18:09:46 +02:00
#include <stdio.h>
#define LOWER 0
#define UPPER 300
#define STEP 20
/* Print Fahrenheit-Celcius table
for fahr = 0, 20, ..., 300 */
main() {
float f, c; /* Fahrenheit and Celcuis Temperature */
/* Heading */
printf("Fahrenheit to Celcius\n");
for (f = UPPER; f >= LOWER; f = f - STEP) {
c = 5.0 / 9.0 * (f - 32);
printf("%6.1f\t%6.1f\n", f, c);
}
}