program PasswordVerification;
varpassword: string;correctPassword: string;attempts: integer;
begincorrectPassword := 'mypassword';attempts := 0;
repeatwrite('Enter the password: ');readln(password);
until (password = correctPassword) or (attempts = 5);
if password = correctPassword thenbeginwriteln('Access granted.');endelsebeginwriteln('Access denied. Too many incorrect attempts.');end;
end.
program PasswordVerification;
var
password: string;
correctPassword: string;
attempts: integer;
begin
correctPassword := 'mypassword';
attempts := 0;
repeat
if password <> correctPassword thenwrite('Enter the password: ');
readln(password);
begin
writeln('Incorrect password. Please try again.');
attempts := attempts + 1;
end;
until (password = correctPassword) or (attempts = 5);
if password = correctPassword then
begin
writeln('Access granted.');
end
else
begin
writeln('Access denied. Too many incorrect attempts.');
end;
end.