Program HOC24;
var n,i,x,d: integer;
a: array[1..32000] of integer;
begin
write('Nhap N : '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,' : '); readln(a[i]);
end;
write('Nhap x : '); readln(x);
d:=0;
for i:=1 to n do if x=a[i] then d:=d+1;
writeln('So ',x,' xuat hien ',d,' lan ');
write('So ',x,' nam o nhung vi tri : ' );
for i:=1 to n do if a[i]=x then write(i,' ; ');
readln
end.
uses crt;
var a,vt:array[1..100]of integer;
dem,i,n,d,x:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap x='); readln(x);
d:=0;
for i:=1 to n do
if a[i]=x then inc(d);
writeln('So lan xuat hien cua ',x,' trong day so la: ',d);
dem:=0;
for i:=1 to n do
if a[i]=x then
begin
inc(dem);
vt[dem]:=i;
end;
if dem>0 then
begin
write('So ',x,' xuat hien o cac vi tri lan luot la: ');
for i:=1 to dem do
write(vt[i]:4);
end;
readln;
end.