-
Lenguaje
Pascal
-
Descripción
Determinar de N cantidades, cuántas son cero, cuántas son menores a cero, y cuántas son mayores a cero.
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
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
program CantidadesCeroMenoresYMayores;
uses crt;
var cantidades_cero, i, mayores_a_cero, menores_a_cero, n : integer;
var cantidad : real;
begin
cantidades_cero := 0;
menores_a_cero := 0;
mayores_a_cero := 0;
write ('Ingresa el valor de n: ');
readln (n);
for i:=1 to n do
begin
writeln ('PROCESO ', i);
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
if cantidad=0 then
begin
cantidades_cero := cantidades_cero+1;
end;
if cantidad<0 then
begin
menores_a_cero := menores_a_cero+1;
end;
if cantidad>0 then
begin
mayores_a_cero := mayores_a_cero+1;
end;
writeln;
end;
writeln ('Valor de cantidades cero: ', cantidades_cero);
writeln ('Valor de menores a cero: ', menores_a_cero);
writeln ('Valor de mayores a cero: ', mayores_a_cero);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var cantidades_cero, i, mayores_a_cero, menores_a_cero, n : integer;
var cantidad : real;
begin
cantidades_cero := 0;
menores_a_cero := 0;
mayores_a_cero := 0;
write ('Ingresa el valor de n: ');
readln (n);
for i:=1 to n do
begin
writeln ('PROCESO ', i);
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
if cantidad=0 then
begin
cantidades_cero := cantidades_cero+1;
end;
if cantidad<0 then
begin
menores_a_cero := menores_a_cero+1;
end;
if cantidad>0 then
begin
mayores_a_cero := mayores_a_cero+1;
end;
writeln;
end;
writeln ('Valor de cantidades cero: ', cantidades_cero);
writeln ('Valor de menores a cero: ', menores_a_cero);
writeln ('Valor de mayores a cero: ', mayores_a_cero);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.