uses crt;
var a:array[1..50]of integer;
n,i,dem,tbc: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: ');
dem:=0;
tbc:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
write(a[i]:4);
inc(dem);
tbc:=tbc+a[i];
end;
writeln;
writeln('So phan tu chan la: ',dem);
writeln('Trung binh cong cua cac so chan trong day la: ',tbc/dem:4:2);
readln;
end.
Đúng 0
Bình luận (0)