Đáp án:
Giải thích bước giải:
var
n,i,dem,S,sc:longint;
A:array[-100..100] of longint;
begin
repeat
write('Nhap n: ');readln(n);
until n>=2;
for i:=1 to n do
begin
write('A[',i,']=');readln(A[i]);
end;
dem:=0;
for i:=1 to n do if A[i]>0 then dem:=dem+1;
if dem=0 then writeln('Khong co so duong nao')
else writeln('Co ',dem,' so duong');
S:=0;
for i:=1 to n do S:=S+A[i];
writeln('Trung binh cong la: ',S/n:5:2);
sc:=2;
for i:=2 to n-1 do if (A[i]-A[i-1]=A[i+1]-A[i]) then sc:=sc+1;
if sc=n then write('Day so la cap so cong')
else write('Day so khong la cap so cong');
readln;
end.