Bài 2:
uses crt;
var a:array[1..199]of integer;
i,n:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{----------------------------xuat-------------------------------}
for i:=1 to n do write(a[i]:4);
readln;
end.
Bài 3:
uses crt;
var a:array[1..199]of integer;
i,n,x,dem:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{----------------------------xu-ly-------------------------------}
write('x='); readln(x);
dem:=0;
for i:=1 to n do
if a[i]=x then inc(dem);
writeln('trong day co ',dem,' gia tri ',x);
readln;
end.