用JAVA写一个将华氏温度转换成摄氏温度的程序
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/16 10:09:31
用JAVA写一个将华氏温度转换成摄氏温度的程序
程序的输入是一个整数,表示华氏温度.输出对应的摄氏温度,也是一个整数.
提示,为了把计算结果的浮点数转换成整数,需要使用下面的表达式:
(int)x;其中x是要转换的那个浮点数.
程序的输入是一个整数,表示华氏温度.输出对应的摄氏温度,也是一个整数.
提示,为了把计算结果的浮点数转换成整数,需要使用下面的表达式:
(int)x;其中x是要转换的那个浮点数.
将华氏温度转换成摄氏温度的Java程序如下:import java.util.Scanner;
public class Fahrenheit {
public static void main (String []args) {
Scanner input =new Scanner(System.in);
System.out.print("Enter a degree in Fahrenehit: ");
int Fahrenehit= input.nextInt();
int Celsius= (int)((Fahrenehit-32)*(5.0/9));
System.out.println(Fahrenehit + " Fahrenehit is "+ Celsius + " Celsius");
}
}运行结果:Enter a degree in Fahrenehit: 50
50 Fahrenehit is 10 Celsius
public class Fahrenheit {
public static void main (String []args) {
Scanner input =new Scanner(System.in);
System.out.print("Enter a degree in Fahrenehit: ");
int Fahrenehit= input.nextInt();
int Celsius= (int)((Fahrenehit-32)*(5.0/9));
System.out.println(Fahrenehit + " Fahrenehit is "+ Celsius + " Celsius");
}
}运行结果:Enter a degree in Fahrenehit: 50
50 Fahrenehit is 10 Celsius
用JAVA写一个将华氏温度转换成摄氏温度的程序
编写一个C#程序,将摄氏温度转换为华氏温度.
编写一个摄氏温度与华氏温度之间的转换程序
编写一个程序,能将摄氏温度转化成华氏温度
JAVA程序题求解 摄氏温度与华氏温度的转换公式为:华氏温度 = 摄氏温度*9/5 + 32.请编写完整的程序完成如下功
用c++编写程序实现华氏温度与摄氏温度的互相转换(摄氏温度=5/9(华氏温度-32).
华氏温度转换成摄氏温度
1;编写一个摄氏温度与华氏温度转换的通用程序,摄氏温度(c)与华氏温度(F)转换公式如下:F=c*9/5+32
用C++:编写一个将华氏温度转换为摄氏温度的函数centigrade( ),其函数原型(调用接口)如下:
还是c 语言的东东1.编写一个将华氏温度转换为摄氏温度的程序,转换公式为C=(5/9)×(F-32).要求:①要求将转换
华氏温度转换为摄氏温度的公式为:C=(F-32)*5/9,请编写一个c语言程序.
用c++编写程序 定义一个函数,实现把华氏温度转换为摄氏温度,公式如下:c=(f