> 其他 >
输入一个摄氏温度,要求输出华氏温度.公式为f=5/9*c+32.(保留1位小数).
示例:
输入:
11.1
输出:
38.2
void main()
{
double c;
scanf("%lf",&c);
printf("%.1f",5.0/9*c+32);
}#include
请问.这里ptintf中,5.0换成5可以么 另外 在定义变量的时候 可否用float?
人气:341 ℃ 时间:2020-05-17 21:25:00
解答
5.0不能换成5,否则5/9=0
可用float,相应改为
float c;
scanf("%f",&c);
推荐
猜你喜欢
© 2025 79432.Com All Rights Reserved.
电脑版|手机版