#include <cstdio>
/*
C=(5/9)(F-32)打印华氏温度与摄氏温度对照表浮点数版本
*/
int main() {
float fahr, celsius;
int lower, upper, step;
lower = 0;//温度表的下限
upper = 300;//温度表的上限
step = 20;//步长
fahr = lower;
while (fahr <= upper) {
celsius = (5.0 / 9.0)*(fahr - 32.0);
printf("%3.0f %6.1f\n", fahr, celsius);
fahr = fahr + step;
}
}
第6页-华氏温度与摄氏温度对照表浮点数版本
猜你喜欢
转载自blog.csdn.net/suifengTYZ/article/details/88234369
今日推荐
周排行