Program tref; var i,sum:integer; mas:array[1..10]of integer; begin for i:=1 to 10 do begin mas[i]:=random(20)-5 ; write(mas[i]:3); end; writeln; for i:=1 to 10 do begin if(mas[i]>=0)then sum:=sum+mas[i] else write(i:3); end; writeln; writeln('sum= ',sum); readln; end.
var i,sum:integer; mas:array[1..10]of integer;
begin
for i:=1 to 10 do
begin
mas[i]:=random(20)-5 ;
write(mas[i]:3);
end;
writeln;
for i:=1 to 10 do
begin
if(mas[i]>=0)then sum:=sum+mas[i] else write(i:3);
end;
writeln;
writeln('sum= ',sum);
readln;
end.