Nếu có lỗi hoặc đáp án sai thì bạn nói mình nhé.
program Hello;
uses crt;
var n,i,j,t,sl1,sl2,sl3:integer;
a:array[1..100] of integer;
begin
readln(n);
sl1:=low(integer); sl2:=sl1; sl3:=sl2;
for i:=1 to n do
read(a[i]);
for i:=2 to n do
if sl1<a[i] then
sl1:= a[i];
for i:= 1 to n do
if ( sl2<a[i]) and (a[i] < sl1) then
sl2:= a[i];
for i:= 1 to n do
if ( sl3<a[i]) and (a[i] < sl2) then
begin
sl3:= a[i];
t:=1;
end;
if (n>2) and (t=1) then
begin
writeln('So lon thu 3: ', sl3);
write('Vi tri: ');
for i:= 1 to n do
if a[i]= sl3 then
write(i,' ');
writeln;
write('Cac so nguyen to nho hon: ');
for i:=2 to sl3 do
begin
t:=0;
for j:= 2 to sl3 do
if (i mod j = 0) and (i<>j) then
t:=1;
if t=1 then continue;
write(i,' ');
end;
end
else
write('None!');
end.