{ У тебя было two+theere+fore+five, т.е. ты складываешь все тройки четверки и тд и делишь на их количество, т.е. всегда будет "1", нужно посчитать сумму и поделить на количество. Подправил твой код:} program p1; const n=20; var i,a1,two,theere,fore,five,sum:integer; sr:double; a:array[1..20] of integer; begin two:=0; theere:=0; fore:=0; five:=0; sr:=0; sum:=0; for i:=1 to n do begin read(a1); sum:= sum + a1; a[i]:=a1; if a[i]=2 then two:=two+1; if a[i]=3 then theere:=theere+1; if a[i]=4 then fore:=fore+1; if a[i]= 5 then five:=five+1;
Подправил твой код:}
program p1;
const n=20;
var i,a1,two,theere,fore,five,sum:integer;
sr:double;
a:array[1..20] of integer;
begin
two:=0;
theere:=0;
fore:=0;
five:=0;
sr:=0;
sum:=0;
for i:=1 to n do
begin
read(a1);
sum:= sum + a1;
a[i]:=a1;
if a[i]=2 then
two:=two+1;
if a[i]=3 then
theere:=theere+1;
if a[i]=4 then
fore:=fore+1;
if a[i]= 5 then
five:=five+1;
end;
writeln('Количество двоек: ',two);
writeln('Количество троек: ',theere);
writeln('Количество четвёрок: ',fore);
writeln('Количество пятёрок: ',five);
sr:=(sum)/n;
writeln(sr);
end.