练习1-4
1-4 编写一个程序打印摄氏温度转换为响应环视温度的转换表.
1 #include<stdio.h> 2 int main() 3 { 4 float fahr, celsius; 5 int lower, upper, step; 6 7 lower = 0; 8 upper = 300; 9 step = 20; 10 celsius = lower; 11 printf("Celsius To Fahr Table\n"); 12 while (celsius <= upper) 13 { 14 fahr = celsius*(9.0 / 5.0) + 32.0; 15 printf("%3.0f %6.1f\n", celsius, fahr); 16 celsius = celsius + step; 17 } 18 return 0; 19 }

浙公网安备 33010602011771号