ALGORITMO CALCULAR EL TAMAÑO DE UN DISCO DADO EN GIGABYTES EN OTRAS UNIDADES CODIGO EN JAVA

CODIGO EN JAVA

package vista;

import java.util.Scanner;

public class Principal {

 
    public static void main(String[] args) {
     
        Scanner t=new Scanner(System.in);
       
        double valor,bytes=1024;
        double megabyte=1024;//*bytes
        double gigabyte=1024;//*megabyte
       
     
        double tgigabyte,tmegabyte,tkilobyte,tbytes;
       
        System.out.println("Ingrese valor en gigabytes");
        valor=t.nextDouble();
       
        tgigabyte=valor;
        tmegabyte=tgigabyte*megabyte;
        tkilobyte=tmegabyte*bytes;
        tbytes=tkilobyte*bytes;
       
        System.out.println("El valor en gigabytes: "+tgigabyte+"\n en megabytes: "+tmegabyte+" \n en kilobytes: "+tkilobyte+
                "\n en bytes es "+tbytes);
       
       
    }
   

}

Comentarios

Entradas populares