uses crt; var i,count:integer; a:array[1..20] of integer;
begin randomize; count:=0; for i:=1 to 20 do a[i]:=random(99)+1; for i:=1 to 20 do write(a[i],' '); for i:=1 to 20-1 do begin if (a[i+1]-a[i]=5) then inc(count); end; writeln; writeln(' count = ', count); readln;
примерно так
uses crt;
var i,count:integer;
a:array[1..20] of integer;
begin
randomize;
count:=0;
for i:=1 to 20 do a[i]:=random(99)+1;
for i:=1 to 20 do write(a[i],' ');
for i:=1 to 20-1 do
begin
if (a[i+1]-a[i]=5) then inc(count); end;
writeln;
writeln(' count = ', count);
readln;
end.