-
Lenguaje
Pascal
-
Descripción
Permite determinar si un valor cualquiera es positivo, negativo o si este es neutro (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
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
program PositivoNegativoONeutroConCiclo;
uses crt;
var numero : real;
var tecla_repetir : char;
begin
repeat
clrscr;
write ('Ingresa el valor de numero: ');
readln (numero);
if numero>0 then
begin
writeln ('Positivo');
end;
if numero=0 then
begin
writeln ('Neutro');
end;
if numero<0 then
begin
writeln ('Negativo');
end;
writeln;
write (#168'Deseas repetir el proceso? (S/N): ');
repeat
tecla_repetir := readkey;
until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
end.
uses crt;
var numero : real;
var tecla_repetir : char;
begin
repeat
clrscr;
write ('Ingresa el valor de numero: ');
readln (numero);
if numero>0 then
begin
writeln ('Positivo');
end;
if numero=0 then
begin
writeln ('Neutro');
end;
if numero<0 then
begin
writeln ('Negativo');
end;
writeln;
write (#168'Deseas repetir el proceso? (S/N): ');
repeat
tecla_repetir := readkey;
until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
end.