Var
a: array [1..10] of integer;
s,i,m,n:integer;
begin
randomize;
for i := 1 to 10 do begin
a[i] := random(10)+1;
write(a[i], ' ');
end;
write(#13+#10+'n = '); readln(n);
write('m = '); readln(m);
if n < 1 then n := 1;
if m > 10 then m := 10;
s := 0;
for i := n to m do s := s + a[i];
writeln('S[',n,'..',m,']=',s );
end.