program puff;
uses crt;
var
mercurio, tierra, marte, jupiter, saturno, urano, neptuno, neptunoB, neptunoK, neptunoM, neptunoG, neptunoT, neptunoP, neptunoMB, neptunoMK, neptunoMM, neptunoMG, neptunoMT, neptunoMP, pluton : int64;
venus : string;
begin
writeln('Hello there!');
writeln('Ingrese la cantidad de bytes a convertir: ');
readln(mercurio);
writeln('');
writeln('¿A que unidad los quiere convertir?');
writeln(' k = kilobytes, m = megabytes, g = gigabytes, t = terabytes, p = petabytes, c = exacto / -v, e = salir ');
readln(venus);
case venus of
{ Convertir a kilobytes }
'k' : begin
tierra := mercurio div 1024;
{pluton := tierra mod 1024;}
writeln('El resultado de convertir ',mercurio,' bytes a kilobytes es: ',tierra,'.');
end;
{ Convertir a megabytes }
'm' : begin
marte := mercurio div 1048576;
{pluton := tierra mod 1024;}
writeln('El resultado de convertir ',mercurio,' bytes a megabytes es: ',marte,'.');
end;
{ Convertir a gigabytes }
'g' : begin
jupiter := mercurio div 1073741824;
{pluton := tierra mod 1024;}
writeln('El resultado de convertir ',mercurio,' bytes a megabytes es: ',jupiter,'.');
end;
{ Convertir a terabytes }
't' : begin
saturno := mercurio div 1099511627776;
{pluton := tierra mod 1024;}
writeln('El resultado de convertir ',mercurio,' bytes a terabytes es: ',saturno,'.');
end;
{ Convertir a petabytes }
'p' : begin
urano := mercurio div 1125899906842624;
{pluton := tierra mod 1024;}
writeln('El resultado de convertir ',mercurio,' bytes a petabytes es: ',urano,'.');
end;
{ Conversion exacta / -v }
'c' : begin
{ /*************************************************************************/ }
{ Petabytes Root }
{ /*************************************************************************/ }
if (mercurio >= 1125899906842624) then
begin
neptunoP := mercurio div 1125899906842624;
neptunoMP := mercurio mod 1125899906842624;
{ Solo para verificar que no se ingreso una cantidad exacta de petabytes }
if (neptunoMP > 0) then
begin
{ Terabyte }
if (neptunoMP >= 1099511627776) and (neptunoMP < 1125899906842624) then
begin
neptunoT := neptunoMP div 1099511627776;
neptunoMT := neptunoMP mod 1099511627776;
{ Gigabyte }
if (neptunoMT >= 1073741824) then
begin
{codigo si el residuo es mayor que un terabyte}
neptunoG := neptunoMT div 1073741824;
neptunoMG := neptunoMT mod 1073741824;
{ Megabyte }
if (neptunoMG > 1048576) then
begin
{codigo si el residuo es mayor que un gigabyte}
neptunoM := neptunoMG div 1048576;
neptunoMM := neptunoMG mod 1048576;
{ Kilobyte }
if (neptunoMM >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMM div 1024;
neptunoMK := neptunoMM mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMM < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMM;
{neptunoMB := neptunoMM mod 1024;}
end
end
{ Kilobyte }
else if (neptunoMG >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMG div 1024;
neptunoMK := neptunoMG mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
end;
end
{ Byte }
else if (neptunoMG < 1024) then
begin
neptunoB := neptunoMG;
end
end
{ Megabyte }
else if (neptunoMT > 1048576) then
begin
{codigo si el residuo es mayor que un gigabyte}
neptunoM := neptunoMT div 1048576;
neptunoMM := neptunoMT mod 1048576;
{ Kilobyte }
if (neptunoMM >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMM div 1024;
neptunoMK := neptunoMM mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMM < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMM;
{neptunoMB := neptunoMM mod 1024;}
end
end
{ Kilobyte }
else if (neptunoMT > 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMT div 1024;
neptunoMK := neptunoMT mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMT < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMT;
{neptunoMB := neptunoMT mod 1024;}
end
end
{ Gigabytes d Petabytes}
else if (neptunoMP > 1073741824) then
begin
{codigo si el residuo es mayor que un Gigabyte}
neptunoG := neptunoMP div 1073741824;
neptunoMG := neptunoMP mod 1073741824;
{ Megabyte }
if (neptunoMG > 1048576) then
begin
{codigo si el residuo es mayor que un Megabyte}
neptunoM := neptunoMG div 1048576;
neptunoMM := neptunoMG mod 1048576;
{ Kilobyte }
if (neptunoMM >= 1024) then
begin
{codigo si el residuo es mayor que un Kilobyte}
neptunoK := neptunoMM div 1024;
neptunoMK := neptunoMM mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un Byte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMM < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMM;
{neptunoMB := neptunoMM mod 1024;}
end;
end
{ Kilobyte }
else if (neptunoMG >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMG div 1024;
neptunoMK := neptunoMG mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMG < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMG;
{neptunoMB := neptunoMG mod 1024;}
end;
end
{ Megabyte d Petabytes }
else if (neptunoMP > 1048576) then
begin
{codigo si el residuo es mayor que un gigabyte}
neptunoM := neptunoMP div 1048576;
neptunoMM := neptunoMP mod 1048576;
{ Kilobyte }
if (neptunoMM >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMM div 1024;
neptunoMK := neptunoMM mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMM < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMM;
{neptunoMB := neptunoMM mod 1024;}
end;
end
{ Kilobyte d Petabytes}
else if (neptunoMP > 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMP div 1024;
neptunoMK := neptunoMP mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
neptunoB := neptunoMK;
end;
end
{ Byte d Petabytes }
else if (neptunoMP < 1024) then
begin
{codigo si el residuo es menor que un kilobyte}
neptunoB := neptunoMP
{neptunoMB := neptunoMP mod 1024;}
end;
end
else if (mercurio <1) then
begin
writeln('Ha digitado la cantidad de ',mercurio,' bytes, para un numero exacto de ',neptunoP,' Petabytes')
end;
end
{ /*************************************************************************/ }
{ aqui termina el universo de terabyte y comienza el surgimiento del reino de Terabyte }
{ /*************************************************************************/ }
{ Terabyte Root }
{ /*************************************************************************/ }
else if (mercurio >= 1099511627776) then
begin
neptunoT := mercurio div 1099511627776;
neptunoMT := mercurio mod 1099511627776;
{ Solo para verificar que no se ingreso una cantidad exacta de Terabytes }
if (neptunoMT > 0) then
begin
{ Gigabyte }
if (neptunoMT > 1073741824) then
begin
{codigo si el residuo es mayor que un terabyte}
neptunoG := neptunoMT div 1073741824;
neptunoMG := neptunoMT mod 1073741824;
{ Megabyte }
if (neptunoMG > 1048576) then
begin
{codigo si el residuo es mayor que un gigabyte}
neptunoM := neptunoMG div 1048576;
neptunoMM := neptunoMG mod 1048576;
{ Kilobyte }
if (neptunoMM >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMM div 1024;
neptunoMK := neptunoMM mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMM < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMM;
{neptunoMB := neptunoMM mod 1024;}
end;
end
{ Kilobyte }
else if (neptunoMG >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMG div 1024;
neptunoMK := neptunoMG mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMG < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMG;
{neptunoMB := neptunoMG mod 1024;}
end;
end
{ Megabyte }
else if (neptunoMT > 1048576) then
begin
{codigo si el residuo es mayor que un gigabyte}
neptunoM := neptunoMT div 1048576;
neptunoMM := neptunoMT mod 1048576;
{ Kilobyte }
if (neptunoMM >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMM div 1024;
neptunoMK := neptunoMM mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMM < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMM;
{neptunoMB := neptunoMM mod 1024;}
end;
end
{ Kilobyte }
else if (neptunoMT > 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMT div 1024;
neptunoMK := neptunoMT mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMT < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMT;
{neptunoMB := neptunoMT mod 1024;}
end;
end
else
begin
writeln('Ha digitado la cantidad de ',mercurio,' bytes, para un numero exacto de ',neptunoT,' Terabytes');
end;
end
{ /*************************************************************************/ }
{ Gigabytes Root }
{ /*************************************************************************/ }
else if (mercurio > 1073741824) then
begin
{codigo si el residuo es mayor que un terabyte}
neptunoG := mercurio div 1073741824;
neptunoMG := mercurio mod 1073741824;
{ Solo para verificar que no se ingreso una cantidad exacta de Gigabytes }
if (neptunoMG > 0) then
begin
{ Megabyte }
if (neptunoMG > 1048576) then
begin
{codigo si el residuo es mayor que un gigabyte}
neptunoM := neptunoMG div 1048576;
neptunoMM := neptunoMG mod 1048576;
{ Kilobyte }
if (neptunoMM >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMM div 1024;
neptunoMK := neptunoMM mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMM < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMM;
{neptunoMB := neptunoMM mod 1024;}
end;
end
{ Kilobyte }
else if (neptunoMG >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMG div 1024;
neptunoMK := neptunoMG mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMG < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMG;
{neptunoMB := neptunoMG mod 1024;}
end;
end
else
begin
writeln('Ha digitado la cantidad de ',mercurio,' bytes, para un numero exacto de ',neptunoT,' gIGAbytes');
end;
end
{ /*************************************************************************/ }
{ Megabyte Root }
{ /*************************************************************************/ }
else if (mercurio > 1048576) then
begin
{codigo si el residuo es mayor que un gigabyte}
neptunoM := mercurio div 1048576;
neptunoMM := mercurio mod 1048576;
{ Solo para verificar que no se ingreso una cantidad exacta de petabytes }
if (neptunoMP > 0) then
begin
{ Kilobyte }
if (neptunoMM >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := neptunoMM div 1024;
neptunoMK := neptunoMM mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ Byte }
else if (neptunoMM < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMM;
{neptunoMB := neptunoMM mod 1024;}
end;
end
else
begin
writeln('Ha digitado la cantidad de ',mercurio,' bytes, para un numero exacto de ',neptunoT,' Gigabytes');
end;
end
{ /*************************************************************************/ }
{ Kilobyte Root }
{ /*************************************************************************/ }
else if (mercurio >= 1024) then
begin
{codigo si el residuo es mayor que un megabyte}
neptunoK := mercurio div 1024;
neptunoMK := mercurio mod 1024;
{ Byte }
if (neptunoMK < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := neptunoMK;
{neptunoMB := neptunoMK mod 1024;}
end;
end
{ /*************************************************************************/ }
{ Byte Root }
{ /*************************************************************************/ }
else if (mercurio < 1024) then
begin
{codigo si el residuo es mayor que un kilobyte}
neptunoB := mercurio;
{neptunoMB := mercurio mod 1024;}
end
{/*******************************************************/}
{ Rara ocasion en la que ingresen una cantidad exacta de bytes de un petabyte }
else
begin
writeln('La conversion de ',mercurio,' bytes es: ',neptunoP,' petabytes exactos.');
end;
end;
'e' : begin
writeln('Hasta luego!')
end;
end;
writeln('END_OF_FILE__');
end.