program bai_tap;
uses crt;
var n,i,dem1,dem2,s1,s2:byte;
tb1,tb2:real;
begin
clrscr;
write('nhap n: ');{nhap gia tri cua n VD: n= 10}
readln(n);
for i:= 1 to n do
if i mod 2 = 0 then {so chan la so chia het cho 2 hay chia 2 du 0}
begin
dem1:=dem1+1; {tinh xem co bao nhieu so mod 2 = 0}
s1:=s1+i; {tinh tong cac so chan}
end
else { neu i mod 2 khac 0 thi...(so le)}
begin
dem2:=dem2+1;
s2:=s2+i;
end;
tb1:= s1/dem1; {tinh trung binh cong}
tb2:= s2/dem2;
writeln('trung binh cong cac so chan: ',tb1:4:2); {xuat ra trung binh cong}
writeln('trung binh cong cac so le: ',tb2:4:2);
readln
end.