-
Lenguaje
Pascal
-
Descripción
Determine cuando una persona puede casarse, aclarando sólo si es mayor de edad y este sea soltero.
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
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
program CondicionesParaCasarse;
uses crt;
var edad, estado_civil : integer;
begin
write ('Ingresa el valor de edad: ');
readln (edad);
writeln ('Selecciona el valor de estado civil.');
writeln (' 1.- Soltero');
writeln (' 2.- Casado');
write (' : ');
repeat
readln (estado_civil);
if (estado_civil<1) or (estado_civil>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (estado_civil>=1) and (estado_civil<=2);
if (edad>=18) and (estado_civil=1) then
begin
writeln ('S'#161' puede casarse');
end
else
begin
writeln ('No puede casarse');
end;
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var edad, estado_civil : integer;
begin
write ('Ingresa el valor de edad: ');
readln (edad);
writeln ('Selecciona el valor de estado civil.');
writeln (' 1.- Soltero');
writeln (' 2.- Casado');
write (' : ');
repeat
readln (estado_civil);
if (estado_civil<1) or (estado_civil>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (estado_civil>=1) and (estado_civil<=2);
if (edad>=18) and (estado_civil=1) then
begin
writeln ('S'#161' puede casarse');
end
else
begin
writeln ('No puede casarse');
end;
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.