n, counter, spisok, new_spisok = int(input()), 0, [], []
while counter != n:
spisok.append(int(input()))
counter += 1
c1, c2 = int(input()), int(input())
for i in spisok:
if c1 <= i <= c2:
new_spisok.append(i)
print(new_spisok, len(new_spisok))
Объяснение:
1) хз зачем там цикл while, но раз в условии написано, то сделал через него;
2) скорее всего работать нужно со списками, а не массивами, так как append - метод списка;
3) если нужно, могу объяснить каждую строку;
4) формат вывода массива не указан, поэтому вывод обычного массива с его длиной через запятую;
5) нижние слеши это пробелы типа)
const
L = 1;
H = 5;
var
b: array [L..H, L..H] of Integer;
i, j, imax, jmax, bmax: Integer;
begin
Randomize;
for i := L to H do begin
WriteLn;
for j := L to H do begin
b [i, j] := Random (100);
Write (b [i, j] :4);
end;
end;
imax := 1;
jmax := 1;
for i := L to H do begin
for j := L to H do begin
if b [i, j] > b [imax, jmax] then begin
imax := i;
jmax := j;
end;
end;
end;
WriteLn;
Writeln ('Максимальный элемент: b [', imax, ', ', jmax, '] = ', b [imax, jmax]);
ReadLn;
end.
ответ и Объяснение
var a:array [1..10] of integer;
max,min,i,temp:integer;
begin
randomize;
for i:=1 to 10 do
begin
a[i]:=random(50);
write (a[i],' ');
end;
writeln;
max:=1;
min:=1;
for i:=2 to 10 do
if a[i] > a[max] then max:=i else
if a[i] < min then min:=i;
writeln ('Max: ',a[max]);
writeln ('Min: ',a[min]);
temp:=a[min];
a[min]:=a[max];
a[max]:=temp;
for i:=1 to 10 do write (a[i],' ');
end.