aboutsummaryrefslogtreecommitdiff
path: root/1/15.c
blob: d608b870970c4df57dea01e75188f9eaa1b9d100 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
	Exercise 1-15. Rewrite the temperature conversion program of Section 1.2
	to use a function for conversion. 
	===
*/

#include <stdio.h>

/* fahrenheit to celsius */ 
float f2c (int f) {
	return (5.0/9.0)*(f-32.0);
}

int main () {
	int f;	/* fahrenheit */
	for (f=0; f<=300; f+=20)
		printf("%3d %6.1f\n", f, f2c(f));
}