-
Lenguaje
Java usando Scanner
-
Descripción
Convertir una cantidad de grados Fahrenheit a Celsius y Kelvin.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.util.Scanner;
public class GradosFahrenheitACelsiusYKelvin {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double grados_Celsius, grados_Fahrenheit, grados_Kelvin;
System.out.print("Ingresa el valor de grados Fahrenheit: ");
grados_Fahrenheit = in.nextDouble();
in.nextLine();
grados_Celsius=(grados_Fahrenheit-32)/1.8;
grados_Kelvin=grados_Celsius+273.15;
System.out.println("Valor de grados Celsius: " + grados_Celsius);
System.out.println("Valor de grados Kelvin: " + grados_Kelvin);
}
}
public class GradosFahrenheitACelsiusYKelvin {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double grados_Celsius, grados_Fahrenheit, grados_Kelvin;
System.out.print("Ingresa el valor de grados Fahrenheit: ");
grados_Fahrenheit = in.nextDouble();
in.nextLine();
grados_Celsius=(grados_Fahrenheit-32)/1.8;
grados_Kelvin=grados_Celsius+273.15;
System.out.println("Valor de grados Celsius: " + grados_Celsius);
System.out.println("Valor de grados Kelvin: " + grados_Kelvin);
}
}