pascalabcnet/InstallerSamples/!Tutorial/06_ForWhileRepeat/For9.pas

26 lines
506 B
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Цикл for. Поиск значения. Оператор break
const n = 10;
var
k: integer;
found: boolean;
begin
writeln('Введите число для поиска: ');
readln(k);
writelnFormat('Введите {0} чисел',n);
found := False;
for var i:=1 to n do
begin
var x: integer;
read(x);
if x=k then
begin
found := True;
break;
end;
end;
if found then
writeln('Найдено')
else writeln('Не найдено');
end.