Commit 6a89426e authored by Juan Manuel Cortez's avatar Juan Manuel Cortez

inicial

parents
program helloworld;
begin
writeln('Hola mundo!');
end.
\ No newline at end of file
program Over50s;
var
name: String;
age: integer;
begin
writeln('Hola, cuál es tu nombre?');
readln(name);
writeln('qué edad tenés '+name+'?');
readln(age);
if(age > 50) then
writeln('Aceptado')
else
writeln('regrese el próximo año');
end.
program conversion;
var
hours, minutes, code: integer;
input: string;
errors: string;
begin
errors := '';
write('Ingrese horas y minutos en formato HH:MM: ');
readln(input);
Val(copy(input,1,2), hours, code);
Val(copy(input,4,5), minutes, code);
//valido minutos
if (hours > 24) OR (hours < 0) then
errors := errors + 'La horas debe ser mayor o igual a 0 y menor o igual a 24. ';
//valido minutos
if (minutes > 59) OR (minutes < 0) then
errors := errors + 'Los minutos deben ser mayores o iguales a 0 y menores o iguales a 59.';
if errors <> '' then
begin
writeln(errors);
exit;
end;
if (hours > 12) then
begin
hours := hours-12;
writeln('La hora es ', hours,':', minutes, 'PM');
end
else
begin
writeln('La hora es ', hours,':', minutes, 'AM');
end
end.
\ No newline at end of file
File added
program conversion;
var
hora, minutos: integer;
input: string;
begin
//si hora < 24 y > 0 entonces
write('Ingrese la hora: ');
readln(hora);
if (hora > 24) OR (hora < 0) then
begin
writeln('La hora debe ser mayor o igual a 0 y menor o igual a 24.');
exit;
end
else
begin
write('Ingrese los minutos: ');
readln(minutos);
if (hora > 12) then
begin
hora := hora-12;
writeln('La hora es igual a ', hora,':', minutos, 'PM');
end
else
begin
writeln('La hora es igual a ', hora,':', minutos, 'AM');
end
end
end.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment