时间限制
400 ms
内存限制
64 MB
题目描述:
给定一个华氏温度F,本题要求编写程序,计算对应的摄氏温度C。计算公式:
C
=
5
×
(
F
−
32
)
/
9
C = 5 × (F − 32) / 9
C=5×(F−32)/9。题目保证输入与输出均在整型范围内。
输入格式:
输入在一行中给出一个华氏温度。
输出格式:
在一行中按照格式“Celsius = C”输出对应的摄氏温度C的整数值。
输入样例:
150
输出样例:
Celsius = 65
给定一个华氏摄氏度 将其转化为 摄氏度
emmmmmmm
直接计算输出
import java.io.*;
import java.math.*;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
int f = sc.nextInt();
int c = 5 * (f - 32) / 9;
out.println("Celsius = " + c);
out.flush();
out.close();
}
static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
}
如果有说错的 或者 不懂的 尽管提 嘻嘻
一起进步!!!