L1-004 计算摄氏温度 (5分)
L1-004 计算摄氏温度 (5分)
给定一个华氏温度 \(F\),本题要求编写程序,计算对应的摄氏温度 \(C\)。计算公式:\(C=5 \times \displaystyle \frac{F−32}{9}\)。题目保证输入与输出均在整型范围内。
输入格式:
输入在一行中给出一个华氏温度。
输出格式:
在一行中按照格式 Celsius = C
输出对应的摄氏温度 \(C\) 的整数值。
输入样例:
150
输出样例:
Celsius = 65
解题思路:
按要求计算并输出即可。
参考代码:
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
cin>>n;
cout<<"Celsius = "<<5*(n-32)/9<<endl;
return 0;
}