-
Lenguaje
Pascal
-
Descripción
Ingresar 100 números. Hallar la suma y la cantidad de los valores positivos.
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
program SumaYPositivosDe100Numeros;
uses crt;
var i, positivos : integer;
var suma, un_numero : real;
begin
positivos := 0;
suma := 0;
for i:=1 to 100 do
begin
writeln ('PROCESO ', i);
write ('Ingresa el valor de un numero: ');
readln (un_numero);
suma := suma+un_numero;
if un_numero>0 then
begin
positivos := positivos+1;
end;
writeln;
end;
writeln ('Valor de positivos: ', positivos);
writeln ('Valor de suma: ', suma:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var i, positivos : integer;
var suma, un_numero : real;
begin
positivos := 0;
suma := 0;
for i:=1 to 100 do
begin
writeln ('PROCESO ', i);
write ('Ingresa el valor de un numero: ');
readln (un_numero);
suma := suma+un_numero;
if un_numero>0 then
begin
positivos := positivos+1;
end;
writeln;
end;
writeln ('Valor de positivos: ', positivos);
writeln ('Valor de suma: ', suma:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.