uses crt;
var a:array[1..100]of integer;
n,i,tbl,tbc,dem,dem1:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
tbc:=0;
tbl:=0;
dem:=0;
dem1:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then
begin
inc(dem);
tbc:=tbc+a[i];
end;
if a[i] mod 2<>0 then
begin
inc(dem1);
tbl:=tbl+a[i];
end;
end;
writeln('Trung binh cong cua cac so chan la: ',tbc/dem:4:2);
writeln('Trung binh cong cua cac so le la: ',tbl/dem1:4:2);
readln;
end.
program BT_1;
uses crt;
var s:string;
i:byte;
begin
write('nhap xau a:');
readln(s);
for i:=1 to length(s)do
if s[i] in ['0'..'9'] then
write (s[i]);
write ('nhap xau b:');
readln(s);
for i:=1 to length(s) do
if s[i] in ['a'..'z'] then
write (s[i]);
readln;
end.
Program HOC24;
var s,a,b: string;
begin
wirte('Nhap xau S:' ); readln(s);
for i:=1 to length(s) do
if s[i] in ['A'..'z'] then a:=a+s[i] else if s[i] in ['0'..'9'] then b:=b+s[i];
writeln('Xau A: ',a);
write('Xau B : ',b);
readln
end.