Program n1; Uses CRT; Const n=20; Var m: array[1..n] of integer; i,a,s,b: integer; begin ClrScr; Randomize; For i:=1 to n do begin m[i]:=random(50); write(m[i]:3); end; writeln; writeln('Введите A и B'); readln(a,b); For i:=a to b do s:=s+m[i]; writeln('Сумма равна ',s); readln end.
Program n1;
Uses CRT;
Const n=20;
Var m: array[1..n] of integer;
i,a,s,b: integer;
begin
ClrScr;
Randomize;
For i:=1 to n do
begin
m[i]:=random(50);
write(m[i]:3);
end;
writeln;
writeln('Введите A и B');
readln(a,b);
For i:=a to b do
s:=s+m[i];
writeln('Сумма равна ',s);
readln
end.