Bài 1:
uses crt;
var a:array[1..100]of integer;
n,i:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Cac so chan trong day la: ');
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
writeln;
writeln('Cac so le trong day la: ');
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
readln;
end.
Bài 2:
uses crt;
var a:array[1..100]of integer;
n,i,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+sqr(a[i]);
writeln('Tong binh phuong cac so trong mang vua nhap la: ',t);
readln;
end.