Const n=40;
var c:array[1..n] of integer;
a,b,i,s,k:integer;
begin
Randomize;
for i:=1 to n do
begin
c[i]:=random(51);
write(c[i]:4);
end;
writeln;
write('a = '); readln(a);
write('b = '); readln(b);
s:=0; k:=0;
for i:=1 to n do
if (c[i]>=a)and(c[i]<=b) then k:=k+1;<br>writeln('k = ',k);
end.
Пример (для n=10):
21 9 39 45 36 35 39 7 23 5
a = 20
b = 30
k = 2