2591 - C二级辅导-温度转换
时间限制 : 1 秒
内存限制 : 128 MB
输入一个华氏温度,要求输出摄氏温度。公式为

保留两位小数
题目输入
题目输出
输入/输出样例
输入格式
-40
输出格式
-40.00
C语言解答
#include <stdio.h> int main() { float fahrenheit; scanf("%f", &fahrenheit); printf("%.2f\n", 5 / 9.0 * (fahrenheit - 32.0)); return 0; }
C++解答
#include <stdio.h> int a[100000]; int main() { double n; while(scanf("%lf",&n)!=EOF) { printf("%.2lf\n",(n-32)*5/9); } return 0; }
Java解答
import java.text.DecimalFormat; import java.util.Scanner; public class Main { public static void main(String[] args) { DecimalFormat df=new DecimalFormat(".00"); Scanner cin = new Scanner(System.in); double a; while (cin.hasNext()) { a = cin.nextDouble(); a=(a-32)*5/9; System.out.println(df.format(a)); } } }