Var A: array[1..100, 1..100] of integer; B: array[1..100]of integer; i, j, k, n, m, imax: integer; manual: boolean;
begin writeln('Ручной ввод (true/false)==>'); read(manual);
if manual then begin writeln('Размер массива n, m ==>'); read(n, m); end else begin n := random(10) + 5; m := random(10) + 5; end;
for i := 1 to n do begin writeln(); for j := 1 to m do begin if manual then read(a[i, j]) else begin a[i, j] := random(100) - 50; write(a[i, j]:3, ' '); end; end; end;
writeln(); writeln();
for j := 1 to m do if j mod 2 = 1 then begin k := k + 1; b[k] := 1; for i := 1 to n do b[k] := b[k] * a[i, j]; write(b[k], ' '); end;
writeln();
for i := 1 to k - 1 do begin imax := i; for j := i + 1 to k do if b[j] > b[imax] then imax := j; n := b[i]; b[i] := b[imax]; b[imax] := n; end;
Uses crt; const q=1000;var a:array[1..q,1..q]of integer; m,n,i,j,c,k,buf:integer; b:array[1..q]of integer; begin writeln('n,m ?') ; readln(n,m); writeln('как заполнять матрицу ?'); writeln(' Нажмите 1 при датчика, 2 - ввод с клавиатуры'); {выбор действия при заполнении} readln(c); case c of 1:for i:=1 to n do begin for j:=1 to m do begin a[i,j]:=random(100); write(a[i,j]:4); end; writeln; end; 2: begin for i:=1 to n do begin for j:=1 to m do readln(a[i,j]); end; clrscr; for i:=1 to n do begin for j:=1 to m do write(a[i,j]:4); writeln; end; end; end; writeln('формирование массива'); for i:=2 to n do begin if i mod 2=0 then for j:=1 to m do if a[i,j]>2 then begin k:=k+1; b[k]:=a[i,j]; end; end; writeln; for i:=1 to k do write(b[i]:4); writeln; {сортировка} for i:=1 to k -1 do for j:=i+1 to k do if b[i]<b[j]then begin buf:=b[i]; b[i]:=b[j]; b[j]:=buf; end; {вывод массива} for i:=1 to k do write(b[i]:4); end.
A: array[1..100, 1..100] of integer;
B: array[1..100]of integer;
i, j, k, n, m, imax: integer;
manual: boolean;
begin
writeln('Ручной ввод (true/false)==>');
read(manual);
if manual then begin
writeln('Размер массива n, m ==>');
read(n, m);
end
else begin
n := random(10) + 5;
m := random(10) + 5;
end;
for i := 1 to n do
begin
writeln();
for j := 1 to m do
begin
if manual then
read(a[i, j])
else begin
a[i, j] := random(100) - 50;
write(a[i, j]:3, ' ');
end;
end;
end;
writeln();
writeln();
for j := 1 to m do
if j mod 2 = 1 then begin
k := k + 1;
b[k] := 1;
for i := 1 to n do
b[k] := b[k] * a[i, j];
write(b[k], ' ');
end;
writeln();
for i := 1 to k - 1 do
begin
imax := i;
for j := i + 1 to k do
if b[j] > b[imax] then
imax := j;
n := b[i];
b[i] := b[imax];
b[imax] := n;
end;
for i := 1 to k do
write(b[i], ' ');
end.
const
q=1000;var
a:array[1..q,1..q]of integer;
m,n,i,j,c,k,buf:integer;
b:array[1..q]of integer;
begin
writeln('n,m ?') ;
readln(n,m);
writeln('как заполнять матрицу ?');
writeln(' Нажмите 1 при датчика, 2 - ввод с клавиатуры');
{выбор действия при заполнении}
readln(c);
case c of
1:for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(100);
write(a[i,j]:4);
end;
writeln;
end;
2:
begin
for i:=1 to n do
begin
for j:=1 to m do
readln(a[i,j]);
end;
clrscr;
for i:=1 to n do
begin
for j:=1 to m do
write(a[i,j]:4);
writeln;
end;
end;
end;
writeln('формирование массива');
for i:=2 to n do
begin
if i mod 2=0 then
for j:=1 to m do
if a[i,j]>2 then
begin
k:=k+1;
b[k]:=a[i,j];
end;
end;
writeln;
for i:=1 to k do
write(b[i]:4);
writeln;
{сортировка}
for i:=1 to k -1 do
for j:=i+1 to k do
if b[i]<b[j]then
begin
buf:=b[i];
b[i]:=b[j];
b[j]:=buf;
end;
{вывод массива}
for i:=1 to k do
write(b[i]:4);
end.