import java.util.Scanner;

public class FahrenheitToCelsius {

public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    System.out.print("请输入华氏度:");
    double fahrenheit = sc.nextDouble();

    double celsius = (fahrenheit - 32) * 5 / 9;

    System.out.printf("摄氏度为:%.2f", celsius);
}

}

要求输入的是华氏度的数据输出的是已经转换完的摄氏度数据。比如输入75输出2389。保留小数点后两位java

原文地址: http://www.cveoy.top/t/topic/hv8o 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录