Page 13

Write a program to print the corresponding Celsius to Fahrenheit table.

#include <stdio.h>

int main()
{
	float fahr, celsius;
	float lower, upper, step;

	lower = 0;
	upper = 300;
	step = 20;

	fahr = lower;
	printf("Celsius to fahrenheit\n");
	while (celsius <= upper) {
		fahr = (celsius * (9.0 / 5.0)) + 32.0;
		printf("%3.0f\t%6.1f\n", celsius, fahr);
		celsius = celsius + step;
	}
}