-
Lenguaje
Pascal
-
Descripción
Permita calcular el numero de CDs necesarios, para hacer una copia de seguridad, de la información almacenada en un disco cuya capacidad se conoce. Considerar que el disco duro esta lleno de información, además expresado en gigabytes. Un CD virgen tiene mas de 700 megabytes de capacidad y un gigabyte es igual a 1024 megabytes.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
program NumeroDeCdsParaRespaldarInformacion;
uses crt;
var informacion_del_disco_duro_en_gigabytes, megabytes, numero_de_CDs : integer;
begin
write ('Ingresa el valor de informacion del disco duro en gigabytes: ');
readln (informacion_del_disco_duro_en_gigabytes);
megabytes := informacion_del_disco_duro_en_gigabytes*1024;
if megabytes mod 700=0 then
begin
numero_de_CDs := megabytes div 700;
end
else
begin
numero_de_CDs := (megabytes+700-megabytes mod 700) div 700;
end;
writeln ('Valor de megabytes: ', megabytes);
writeln ('Valor de numero de CDs: ', numero_de_CDs);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var informacion_del_disco_duro_en_gigabytes, megabytes, numero_de_CDs : integer;
begin
write ('Ingresa el valor de informacion del disco duro en gigabytes: ');
readln (informacion_del_disco_duro_en_gigabytes);
megabytes := informacion_del_disco_duro_en_gigabytes*1024;
if megabytes mod 700=0 then
begin
numero_de_CDs := megabytes div 700;
end
else
begin
numero_de_CDs := (megabytes+700-megabytes mod 700) div 700;
end;
writeln ('Valor de megabytes: ', megabytes);
writeln ('Valor de numero de CDs: ', numero_de_CDs);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.