Câu 1:
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n: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 la: ');
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
writeln;
writeln('Cac so le la: ');
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
writeln;
writeln('Cac so chia het cho 3 la: ');
for i:=1 to n do
if a[i] mod 3=0 then write(a[i]:4);
readln;
end.
Câu 3:
uses crt;
var a:array[1..100]of integer;
i,n: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 o vi tri chan la: ');
for i:=1 to n do
if i mod 2=0 then write(a[i]:4);
writeln;
writeln('Cac so o vi tri le la: ');
for i:=1 to n do
if i mod 2=1 then write(a[i]:4);
readln;
end.