• Lenguaje

    Pascal

  • Descripción

    Leer 30 números mostrar cuantos son positivos, cuantos negativos y cuantos neutros.

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
program PositivosNegativosYNeutros2;
uses crt;

var i, negativos, neutros, positivos : integer;
var un_numero : real;
begin
    negativos := 0;
    neutros := 0;
    positivos := 0;
    for i:=1 to 30 do
    begin
        writeln ('PROCESO ', i);
        write ('Ingresa el valor de un numero: ');
        readln (un_numero);
        if un_numero<0 then
            begin
                negativos := negativos+1;
            end;
        if un_numero=0 then
            begin
                neutros := neutros+1;
            end;
        if un_numero>0 then
            begin
                positivos := positivos+1;
            end;
        writeln;
    end;
    writeln ('Valor de negativos: ', negativos);
    writeln ('Valor de neutros: ', neutros);
    writeln ('Valor de positivos: ', positivos);
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.