Pascal ABC. Write a procedure that prints the first 3 elements from an array that are not equal to each other.

Pascal ABC. Write a procedure that prints the first 3 elements from an array that are not equal to each other. Or the procedure for finding 3 maximum array elements that are not equal to each other.

Var
arr: array [0..1000] of integer;
n, i: integer;

procedure tri_el; {a procedure that prints the first 3 elements from an array that are not equal to each other}

var
q, j: integer;
o: array [1..3] of integer; {array of numbers that are not equal to each other}
begin
write (arr [1], ”);
q: = 1;
o [q]: = arr [1];
i: = 1;
while q <> 3 do
begin
i: = i + 1;
if q = 1 then
if arr [i] <> o [1] then
begin
write (arr [i], ”);
q: = q + 1;
o [q]: = arr [i];
end;

if q = 2 then
if (arr [i] <> o [1]) and (arr [i] <> o [2]) then
begin
write (arr [i]);
q: = q + 1;
end;
end;
end;

procedure tri_max; {procedure for finding 3 maximum array elements that are not equal to each other}
var
mks: array [1..3] of integer; {array of maximum values}
begin

for i: = 1 to 3 do
mks [i]: = 0;
for i: = 1 to n do
if mks [1] <arr [i] then

begin
mks [3]: = mks [2];
mks [2]: = mks [1];
mks [1]: = arr [i];
end

else
if (mks [2] <arr [i]) and (arr [i] <> mks [1]) then

begin
mks [3]: = mks [2];
mks [2]: = arr [i];
end;

else
if (mks [3] <arr [i]) and (mks [2] <> arr [i]) then mks [3]: = arr [i];
write (mks [1], ”, mks [2], ”, mks [3]); {displaying the 3 maximum array elements that are not equal to each other}
end;



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.