//2)
//Pascal
var
A: array [1..255] of integer;
N, i: byte;
begin
randomize;
write('Введите N: '); readln(N);
writeln('Случайный массив из положительных.');
for i := 1 to N do begin
A[i] := random(50);
write(A[i]:4);
end;
writeln;
for i := 1 to N do begin
if A[i] mod 2 = 0 then A[i] := 2
else A[i] := 1;
write(A[i]:4);
end;
writeln; readln; //Если PascalABC.NET, можно убрать
end.
//1)
//Pascal
var
A: array [1..8] of integer;
i: byte;
begin
randomize;
writeln('Случайный массив.');
for i := 1 to 8 do
begin
A[i] := random(41)-20;
write(A[i]:6);
end;
writeln;
for i := 1 to 8 do
begin
if (A[i] mod 5 = 0)=false or (A[i] > 0)=false then
begin
if A[i] mod 5 = 0 then
A[i] := 100
else
if A[i] > 0 then
A[i] := -100;
end;
write(A[i]:6);
end;
writeln; readln; //Если PascalABC.NET, можно убрать
end.