var
b:array[1..100] of integer;
i, count, n:integer;
begin
randomize;
write('n = '); readln(n);
for i := 1 to n do
begin
b[i] := random(51) - 25;
writeln('b[', i, '] = ', b[i]);
end;
writeln;
count := 0;
for i := 1 to n do
if b[i] >= 0 then
begin
writeln('b[', i, '] = ', b[i], ' >= 0');
inc(count);
end;
writeln('Count = ', count);
end.
// вторая программа
const
n = 20;
var
a:array[1..n] of integer;
i, k:integer;
begin
randomize;
writeln('Исходный массив: ');
for i := 1 to n do
begin
a[i] := random(51);
write(a[i], ' ');
end;
writeln;
write('k = '); readln(k);
if (k > n) or (k < 1) then
begin
writeln('элемента с таким индексом нет');
readln;
Exit;
end;
for i := k to n - 1 do
a[i] := a[i + 1];
a[n] := 0;
writeln('Измененный массив:');
for i := 1 to n - 1 do
write(a[i], ' ');
readln;
writeln;
end.