-
Lenguaje
Java usando Scanner
-
Descripción
Usted va a adquirir un disco duro para su computador y el vendedor le ofrece tamaños de disco duro expresados en Terabyte. Para lo cual usted realiza análisis del problema que le permite convertir ese valor en Megabyte y en Gigabyte.
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 TerabytesAMegabytesYGigabytes {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double gigabytes, megabytes, terabytes;
System.out.print("Ingresa el valor de terabytes: ");
terabytes = in.nextDouble();
in.nextLine();
gigabytes=terabytes*1024;
megabytes=gigabytes*1024;
System.out.println("Valor de gigabytes: " + gigabytes);
System.out.println("Valor de megabytes: " + megabytes);
}
}
public class TerabytesAMegabytesYGigabytes {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double gigabytes, megabytes, terabytes;
System.out.print("Ingresa el valor de terabytes: ");
terabytes = in.nextDouble();
in.nextLine();
gigabytes=terabytes*1024;
megabytes=gigabytes*1024;
System.out.println("Valor de gigabytes: " + gigabytes);
System.out.println("Valor de megabytes: " + megabytes);
}
}