Skip to content
This repository was archived by the owner on Dec 29, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Linear_search_pascal/linearSearch.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
program LinearSearch;
{$Apptype Console}
const
UPPER_BOUND = 9;

arr : array[1 .. UPPER_BOUND ] of string = ('Mohit', 'Yadav', 'Yooo',
'You', 'are', 'Going', 'to', 'win', 'hacktoberfest');
var
l, c : integer;
f : Boolean;
name : string;
begin
c := 1;
f := false;
write('Enter the name');
readln(name);
while (c <= UPPER_BOUND) and (not f) do
begin
if arr[c] = name then
begin
writeln(name, ' is in position ', c);
f := true;
end
else
c := c + 1;
end;
if not f then
begin
writeln(name, ' is not in the list.');
end;
readln;
end.