人間夜行

一切の有為の法 夢幻泡影の如し

K&R C Bible Exercises 1-5

| 评论

Modify the temperature conversion program to print the table in reverse order, that is, from 300 degrees to 0.

Example:

#include <stdio.h>
/* print Fahrenheit-Celsius table */
int main()
{
	int fah;
	printf("Fahrenheit-Celsius Table\n");
	printf("%6s %6s\n","F","C");
	printf("---------------\n");
	for(fah=300;fah>=0;fah-=20)
		printf("%6d %6.1f\n",fah,(fah-32)*5.0/9.0);
	return 0;
}
 

评论