uses crt;
var n,i:shortint;
a:array[1..20] of byte;
function snt(x:byte):boolean;
var t:byte;
begin
if x<2 then exit(false)
else
begin
snt:=true;
for t:=2 to trunc(sqrt(x)) do
if x mod t=0 then exit(false)
end;
end;
BEGIN
clrscr;
write('Nhap N:'); readln(n);
randomize;
writeln('So phan tu cua mang: ',n);
for i:=1 to n do
a[i]:=random(99)+1;
writeln('Mang a la:');
for i:=1 to n do write(' ',a[i]);
writeln;
write('Vi tri cac so nguyen to co trong a la:');
for i:=1 to n do
if snt(a[i]) then write(' ',i);
readln
END.
Chúc bạn học tốt!