Var a:array[1..100,1..100] of integer; i,j,n,m,max,min:integer; begin write ('Введите количество строк: '); read(n); writeln; write ('Введите количество элементов в строке: '); read(m); writeln; writeln('Введите массив: '); for i:=1 to n do begin for j:=1 to m do begin write(' a[',i,',',j,']='); read(a[i,j]); end; writeln; end; writeln; writeln('Исходный массив: '); for i:=1 to n do begin for j:=1 to m do write(a[i,j],' '); writeln; end; writeln; writeln('Конечный массив: '); for i:=1 to n do begin min:=a[i,1]; max:=a[i,1]; for j:=2 to m do begin if (min>a[i,j]) then min:=a[i,j]; if (max
Объяснение:
const
max_elements = 1000;
a = 1;
b = 15;
first_file_name = '1.txt';
second_file_name = '2.txt';
var
i, j, n, r:integer;
p:real;
ar:array[1..max_elements] of integer;
f1, f2:text;
begin
randomize;
writeln('Input n = ');
readln(n);
for i:=1 to n do begin
ar[i]:=random(b-a+1)+a;
end;
assign(f1, first_file_name);
rewrite(f1);
for i:=1 to n do begin
writeln(f1, ar[i]);
end;
close(f1);
assign(f2, second_file_name);
rewrite(f2);
for i:=1 to n do begin
p:=1;
for j:=1 to i do
p:=p*ar[j];
writeln(f2, p:0:0);
end;
close(f2);
readln;
end.