温度转换-题解

描述

本题要求编写程序,给定一个华氏温度F,计算对应的摄氏温度C;注意,按照规定的格式输出

例如:计算摄氏温度为-12,则要输出Celsius=-12

计算公式:C=5×(F−32)÷9

输入描述

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

输出描述

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

代码

1
2
3
4
5
6
7
8
9
10
#include <bits/stdc++.h>
using namespace std;

int main(){
int a;
cin >> a;
int c= 5*(a-32)/9;
cout<< "Celsius=" << c;
return 0;
}

温度转换-题解
https://chenxi-tijie.pages.dev/2025/06/温度转换-题解/
作者
chenxi
发布于
2025年6月8日
许可协议