将华氏温度转换成摄氏温度
直接代码:
#include <stdio.h>
void temperatureConvert(double b, double e);
int main(int argc, char *argv[])
{
temperatureConvert(-10.0, 20.0);
return 0;
}
void temperatureConvert(double b, double e)
{
for (double cent = b; cent <= e; cent += 2.5) {
double fahr = (9.0/5.0)*cent+32.0;
printf("%-10.3f:%.3f\n", cent, fahr);
}
}