Const n=20;
var x:array[1..n] of integer;
a,b,k,i:integer;
begin
Randomize;
writeln('Массив:');
for i:=1 to n do begin
x[i]:=random(51);
write(x[i],' ');
end;
writeln;
write('a, b (areadln(a,b);
k:=0;
for i:=1 to n do
if (x[i]>=a)and(x[i]<=b) then k:=k+1;<br>writeln('k = ',k);
end.
Пример:
Массив:
27 5 38 46 22 2 0 22 17 49 28 30 33 16 6 33 35 33 14 2
a, b (ak = 8