-
Lenguaje
Pascal
-
Descripción
El costo de un envío de fax ordinario es de $1,000 si el número de palabras es hasta 10, por cada palabra adicional se cobra $200.
Si el envio de fax es urgente los costos son de $2,000 y $400 respectivamente.
Lea el tipo de envío y el número de palabras de telegrama y escriba el costo a pagar de este.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
program CostoDeTelegrama;
uses crt;
var costo_a_pagar, palabras, tipo_de_envio : integer;
begin
write ('Ingresa el valor de palabras: ');
readln (palabras);
costo_a_pagar := 0;
writeln ('Selecciona el valor de tipo de envio.');
writeln (' 1.- ordinario');
writeln (' 2.- urgente');
write (' : ');
repeat
readln (tipo_de_envio);
if (tipo_de_envio<1) or (tipo_de_envio>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_envio>=1) and (tipo_de_envio<=2);
if (tipo_de_envio=1) and (palabras<=10) then
begin
costo_a_pagar := 1000;
end;
if (tipo_de_envio=1) and (palabras>10) then
begin
costo_a_pagar := 1000+(palabras-10)*200;
end;
if (tipo_de_envio=2) and (palabras<=10) then
begin
costo_a_pagar := 2000;
end;
if (tipo_de_envio=2) and (palabras>10) then
begin
costo_a_pagar := 2000+(palabras-10)*400;
end;
writeln ('Valor de costo a pagar: ', costo_a_pagar);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var costo_a_pagar, palabras, tipo_de_envio : integer;
begin
write ('Ingresa el valor de palabras: ');
readln (palabras);
costo_a_pagar := 0;
writeln ('Selecciona el valor de tipo de envio.');
writeln (' 1.- ordinario');
writeln (' 2.- urgente');
write (' : ');
repeat
readln (tipo_de_envio);
if (tipo_de_envio<1) or (tipo_de_envio>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_envio>=1) and (tipo_de_envio<=2);
if (tipo_de_envio=1) and (palabras<=10) then
begin
costo_a_pagar := 1000;
end;
if (tipo_de_envio=1) and (palabras>10) then
begin
costo_a_pagar := 1000+(palabras-10)*200;
end;
if (tipo_de_envio=2) and (palabras<=10) then
begin
costo_a_pagar := 2000;
end;
if (tipo_de_envio=2) and (palabras>10) then
begin
costo_a_pagar := 2000+(palabras-10)*400;
end;
writeln ('Valor de costo a pagar: ', costo_a_pagar);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.