写一个程序,将接收的摄氏温度转换为对应的华氏温度。程序应显示如下的提示信息:
Please input cels:
然后输入一个十进制数并回车,然后程序以合适的消息形式输出转换后的华氏温度。
程序使用如下的公式完成转换:fahr=9/5*cels+32
**输入格式要求:"%lf" 提示信息:"Please input cels: "
**输出格式要求:"The fahr is: %.2f"
程序运行结果示例:
Please input cels: 32
The fahr is: 89.60
供参考:
#include <stdio.h>
int main()
{
double cels, fahr;
printf("Please input cels:");
scanf("%lf", &cels);
fahr = 9.0 * cels / 5.0 + 32;
printf("The fahr is: %.2f", fahr);
return 0;
}
按照公式转换就行
#include <stdio.h>
int main()
{
double cels,fahr;
printf("Please input cels:");
scanf("%lf",&cels);
fahr = 1.8*cels+32;
printf("The fahr is: %.2f",fahr);
}