begin {ввод массива} if handsfree then n := random(20) + 5 else begin write('n = '); readln(n); end;
writeln('Данные массива:'); for i := 1 to n do begin if handsfree then begin a[i] := random(100) - 50; write(a[i]:3, ' '); end else readln(a[i]); end; writeln();
{изменение элементов} for i := 1 to n do begin if a[i] < 0 then a[i] := abs(a[i]); write(a[i]:3, ' '); end; end.
handsfree = true;
var
a: array[1..100] of real;
i, n: integer;
begin
{ввод массива}
if handsfree then
n := random(20) + 5
else begin
write('n = ');
readln(n);
end;
writeln('Данные массива:');
for i := 1 to n do
begin
if handsfree then begin
a[i] := random(100) - 50;
write(a[i]:3, ' ');
end
else readln(a[i]);
end;
writeln();
{изменение элементов}
for i := 1 to n do
begin
if a[i] < 0 then
a[i] := abs(a[i]);
write(a[i]:3, ' ');
end;
end.