-
Lenguaje
Pascal
-
Descripción
Lee un número por teclado y dice si es positivo o negativo.
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 PositivoONegativoConCiclo;
uses crt;
var un_numero : real;
var tecla_repetir : char;
begin
repeat
clrscr;
write ('Ingresa el valor de un numero: ');
readln (un_numero);
if un_numero<0 then
begin
writeln ('Negativo');
end
else
begin
writeln ('Positivo');
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 un_numero : real;
var tecla_repetir : char;
begin
repeat
clrscr;
write ('Ingresa el valor de un numero: ');
readln (un_numero);
if un_numero<0 then
begin
writeln ('Negativo');
end
else
begin
writeln ('Positivo');
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.