[CCCC-GPLT] L1-004 计算摄氏温度 (5分)

    科技2022-07-12  143

    给定一个华氏温度F,本题要求编写程序,计算对应的摄氏温度C。计算公式:C=5×(F−32)/9。题目保证输入与输出均在整型范围内。

    Input Specification:

    输入在一行中给出一个华氏温度。

    Output Specification:

    在一行中按照格式“Celsius = C”输出对应的摄氏温度C的整数值。

    Sample Input:

    150

    Sample Output:

    Celsius = 65

    Analysis

    按给出的公式计算即可

    Code:

    #include<iostream> using namespace std; int main() { long c,f; cin>>f; c=(f-32)*5/9; cout<<"Celsius = "<<c; return 0; }
    Processed: 0.009, SQL: 8