program ct;
uses crt;
var A:array[1..1000] of integer;
i,n,x:integer;
S,Sb:longint;
begin clrscr;
write('Nhap so phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap A[',i,']: '); readln(A[i]);
end;
for i:=1 to n do
begin
S:=S+A[i];
if A[i] mod 3=0 then Sb:=Sb+A[i];
end;
write('Day so tren la: ');
for i:=1 to n do
write(A[i]:3);
writeln;
writeln('Tong la: ',S);
write('Cac phan tu la boi cua 3 la: ');
for i:=1 to n do
if A[i] mod 3=0 then write('A[i]:3);
writeln;
writeln('Tong la: ',Sb);
write('Nhap so x: '); readln(x);
for i:=1 to n do
if A[i]=x then write(x', thuoc day so tren')
else write(x', khong thuoc day so tren');
readln;
end.
Học tốt!