Var a:array[1..20] of integer; i,n,min,max,s:integer; begin randomize; s:=0; writeln ('Введи кол-во элементов в массиве'); readln(n); for i:=1 to n do a[i]:=random(35)-10; for i:=1 to n do if i mod 2 = 0 then writeln ('a[',i,']=',a[i]); for i:=1 to n do if i mod 2 >0 then writeln ('a[',i,']=',a[i]); for i:=1 to n do if (a[i] mod 3 = 0) or (a[i] mod 5 = 0) then s:=s+a[i]; writeln ('Сумма членов кратных 3 или 5 = ',s); min:=a[1]; max:=a[1]; for i:=2 to n do begin if a[i]<min then min:=a[i]; if a[i]>max then max:=a[i]; end; writeln ('Максимум=',max); writeln('Минимум=',min); end.
1)uses crt; const m=5; n=5; var a:array[1..m,1..n] of integer; b:array[1..m] of integer; i,max,min,j,k,p:integer; begin randomize; for i:=1 to m do for j:=1 to n do a[i,j]:=random(20); min:=20; max:=0; for i:=1 to m do begin for j:=1 to n do write(a[i,j]:3); writeln; end; writeln; k:=1; repeat for i:=k to k do for j:=1 to n do begin if (a[i,j]<min) then begin min:=a[i,j]; b[k]:=a[i,j]; end; end; inc(k); min:=20; until k>n; for p:=1 to m do if (b[p]>max) then max:=b[p]; writeln(max); end.
2)uses crt; const n=5; var a:array[1..n,1..n] of integer; b:array[1..n] of integer; i,j,k,p,t,min,max:integer; begin randomize; for i:=1 to n do for j:=1 to n do a[i,j]:=random(5); for i:=1 to n do begin for j:=1 to n do write(a[i,j]:3); writeln; end; writeln; k:=1; t:=0; repeat for i:=1 to n do for j:=k to k do if a[i,j]=0 then inc(t); b[k]:=t; t:=0; inc(k); until k>n; min:=5; max:=0; for p:=1 to n do begin if(b[p]>max) then max:=p; if(b[p]<min) and (b[p]<>0) then min:=p; end; k:=1; repeat for i:=k to k do //for j:=1 to n do begin a[k,min]:=a[k,min]+a[k,max]; a[k,max]:=a[k,min]-a[k,max]; a[k,min]:=a[k,min]-a[k,max]; inc(k); end; until k>n; for i:=1 to n do begin for j:=1 to n do write(a[i,j]:3); writeln; end; writeln; end.
a:array[1..20] of integer;
i,n,min,max,s:integer;
begin
randomize;
s:=0;
writeln ('Введи кол-во элементов в массиве');
readln(n);
for i:=1 to n do
a[i]:=random(35)-10;
for i:=1 to n do
if i mod 2 = 0 then writeln ('a[',i,']=',a[i]);
for i:=1 to n do
if i mod 2 >0 then writeln ('a[',i,']=',a[i]);
for i:=1 to n do if (a[i] mod 3 = 0) or (a[i] mod 5 = 0) then s:=s+a[i];
writeln ('Сумма членов кратных 3 или 5 = ',s);
min:=a[1];
max:=a[1];
for i:=2 to n do begin
if a[i]<min then min:=a[i];
if a[i]>max then max:=a[i];
end;
writeln ('Максимум=',max);
writeln('Минимум=',min);
end.
const m=5;
n=5;
var a:array[1..m,1..n] of integer;
b:array[1..m] of integer;
i,max,min,j,k,p:integer;
begin
randomize;
for i:=1 to m do
for j:=1 to n do
a[i,j]:=random(20);
min:=20;
max:=0;
for i:=1 to m do
begin
for j:=1 to n do
write(a[i,j]:3);
writeln;
end;
writeln;
k:=1;
repeat
for i:=k to k do
for j:=1 to n do
begin
if (a[i,j]<min) then begin min:=a[i,j]; b[k]:=a[i,j]; end;
end;
inc(k);
min:=20;
until k>n;
for p:=1 to m do
if (b[p]>max) then max:=b[p];
writeln(max);
end.
2)uses crt;
const n=5;
var a:array[1..n,1..n] of integer;
b:array[1..n] of integer;
i,j,k,p,t,min,max:integer;
begin
randomize;
for i:=1 to n do
for j:=1 to n do
a[i,j]:=random(5);
for i:=1 to n do
begin
for j:=1 to n do
write(a[i,j]:3);
writeln;
end;
writeln;
k:=1;
t:=0;
repeat
for i:=1 to n do
for j:=k to k do
if a[i,j]=0 then inc(t);
b[k]:=t;
t:=0;
inc(k);
until k>n;
min:=5;
max:=0;
for p:=1 to n do
begin
if(b[p]>max) then max:=p;
if(b[p]<min) and (b[p]<>0) then min:=p;
end;
k:=1;
repeat
for i:=k to k do
//for j:=1 to n do
begin
a[k,min]:=a[k,min]+a[k,max];
a[k,max]:=a[k,min]-a[k,max];
a[k,min]:=a[k,min]-a[k,max];
inc(k);
end;
until k>n;
for i:=1 to n do
begin
for j:=1 to n do
write(a[i,j]:3);
writeln;
end;
writeln;
end.