uses crt; var a:array[1..10001] of longint; n,i,chan,le:longint; begin clrscr; readln(n); for i:=1 to n do begin writeln(‘a[‘,i,’]=’);readln(a[i]);end; for i:=n downto 1 do if a[i] mod 2=0 then chan:=a[i] else le:=a[i]; writeln(‘so chan dau tien= ‘,chan); write(‘so le dau tien= ‘,le); readln; end.
program phuongt;
uses crt;
var A: array[1..500] of integer;
i, n: intger;
begin
clrscr;
write(‘Nhap n = ‘); readln(n);
for i:=1 to n do
begin
write(‘A[‘, i,’] = ‘); readln(A[i]);
end;
write(‘So chan dau tien trong mang la: ‘);
for i:=1 to n do
if A[i] mod 2 = 0 then
begin
write(A[i]);
break;
end;
writeln();
write(‘So le dau tien trong mang la: ‘);
for i:=1 to n do
if A[i] mod 2 = 1 then
begin
write(A[i]);
break;
end;
readln
end.
uses crt;
var a:array[1..10001] of longint;
n,i,chan,le:longint;
begin
clrscr;
readln(n);
for i:=1 to n do begin writeln(‘a[‘,i,’]=’);readln(a[i]);end;
for i:=n downto 1 do if a[i] mod 2=0 then chan:=a[i] else le:=a[i];
writeln(‘so chan dau tien= ‘,chan);
write(‘so le dau tien= ‘,le);
readln;
end.