华氏温度转换为摄氏温度
描述
输入华氏温度f,计算并输出相应的摄氏温度c(保留2 位小数)。c = 5/9(f-32).
输入
输入一个实数x表示华氏温度
输出
输出对应的摄氏温度
输入样例 1
17.2
输出样例 1
The temprature is -8.22
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
float x,f;
while(cin>>x)
{
f=(5.0/9.0)*(x-32.0);
printf("The temprature is %0.2f\n",f);
}
return 0;
}
调用c的头文件控制保留2为小数