Var n,i,k,s,min:longint; a:array[1..100] of longint; begin Write('Write size array: '); readln(n); for i:=1 to n do begin a[i]:=Random(50); write(a[i]:4); end; min:=a[1]; k:=1; s:=0; for i:=1 to n do if a[i]<min then begin min:=a[i]; k:=i; end; for i:=1 to k do s:=s+a[i]; writeln(s); readln end.
n,i,k,s,min:longint;
a:array[1..100] of longint;
begin
Write('Write size array: '); readln(n);
for i:=1 to n do
begin
a[i]:=Random(50);
write(a[i]:4);
end;
min:=a[1];
k:=1;
s:=0;
for i:=1 to n do
if a[i]<min
then
begin
min:=a[i];
k:=i;
end;
for i:=1 to k do
s:=s+a[i];
writeln(s);
readln
end.