![]() ![]() ![]() | temperature-table.c - Et program som udskriver en nyttig temperaturkonverteringstabel. | Lektion 3 - slide 16 : 26 Program 2 |
#include <stdio.h> double celcius_temperature(double fahrenheit_temp){ return (5.0 / 9.0) * (fahrenheit_temp - 32.0); } int main(void){ double f; printf("%-20s %-20s\n", "Fahrenheit degrees", "Celcius degrees"); for (f = 1.0; f <= 100.0; f++) printf("%-20.2lf %-20.2lf\n", f, celcius_temperature(f)); return 0; }