1
const n = 10;
var
a : array [1..n] of integer;
i : integer;
begin
randomize;
// Выбери нужный for
for i := 1 to n do
begin
a[i] := i;
writeln (a[i]);
end;
//a[1]=1,a[2]=2...a[10]=10
//рандомом
for i := 1 to n do
begin
a[i] := 1 + random (9);
writeln (a[i]);
end;
end.
2
const n = 25; //кол-во элементов
var a : array [1..n] of integer;
i,k : integer;
begin
randomize;
for i := 1 to n do
a[i] := -20+random(40);
k := 0;
for i := 1 to n do
if a[i] mod 2 =1 then
k := k +1;
writeln (k);
end.
3
const n = 10;
var a : array [1..n] of integer;
i,s1,s2 : integer;
begin
randomize;
for i := 1 to n do
begin
a[i] := -10+random(21);
writeln (a[i]);
end;
s1 := 0;
s2 := 0;
for i := 1 to n do
begin
if a[i] > 0 then
s1 := s1 +a[i];
if a[i] < 0 then
s2 := s2 +a[i];
end;
writeln ('Сумма положительных=',s1);
writeln ('Сумма отрицательных=',s2);
end.