写一个程序,将接收的摄氏温度转换为对应的华氏温度。程序应显示如下的提示信息:
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 c;
printf("Please input cels:");
scanf("%lf",&c);
printf("The fahr is:%.2f",9/5.0*c+32);
return 0;
}
#include<stdio.h>
int main()
{
double cels,fahr;
printf("Please input cels: 32");
scanf("%lf",&cels);
fahr=(9/5.0)*cels+32;
printf( "The fahr is: %.2f ",fahr);
return 0;
}