var A, F, G: array [1..20] of integer;
sA, sF: string;
i: integer;
begin
for i:= 1 to 20 do
A[i] := random(-20, 20);
F[i] := random(-20, 20);
sA += A[i] + ' ';
sF += F[i] + ' ';
end;
writeln('A: ' + sA);
writeln('F: ' + sF);
write('G: ');
if A[i] < F[i] then
G[i] := A[i]
else
G[i] := F[i];
write(G[i] + ' ');
writeln();
end.
1)
const N = 10;
var A: array [1..N, 1..N] of integer;
i, j, maxMain, maxSecond: integer;
writeln('A: ');
for i:= 1 to N do
for j:= 1 to N do
A[i, j]:= random(-30, 30);
write(A[i, j]:4);
for i:=1 to N do
if (i = j) and (maxMain < A[i, j]) then
maxMain := A[i, j];
if (i + j = N + 1) and (maxSecond < A[i, j]) then
maxSecond := A[i, j];
writeln('Макс. на глав. диагонали: ' + maxMain);
writeln('Макс. на побочной. диагонали: ' + maxSecond);
2)
var A: array [1..N] of real;
B, C: array of real;
write('A: ');
A[i]:=random(-10, 10);
write(A[i] + ' ');
if (a[i] > 0) then
SetLength(B, Length(B) + 1);
B[High(B)]:=a[i];
if (a[i] < 0) then
SetLength(C, Length(C) + 1);
C[High(C)]:=a[i];
write('B: ');
for i:= 0 to Length(B) - 1 do
write(B[i] + ' ');
write('C: ');
for i:= 0 to Length(C) - 1 do
write(C[i] + ' ');
var A, F, G: array [1..20] of integer;
sA, sF: string;
i: integer;
begin
for i:= 1 to 20 do
begin
A[i] := random(-20, 20);
F[i] := random(-20, 20);
sA += A[i] + ' ';
sF += F[i] + ' ';
end;
writeln('A: ' + sA);
writeln('F: ' + sF);
write('G: ');
for i:= 1 to 20 do
begin
if A[i] < F[i] then
G[i] := A[i]
else
G[i] := F[i];
write(G[i] + ' ');
end;
writeln();
end.
1)
const N = 10;
var A: array [1..N, 1..N] of integer;
i, j, maxMain, maxSecond: integer;
begin
writeln('A: ');
for i:= 1 to N do
begin
for j:= 1 to N do
begin
A[i, j]:= random(-30, 30);
write(A[i, j]:4);
end;
writeln();
end;
for i:=1 to N do
begin
for j:= 1 to N do
begin
if (i = j) and (maxMain < A[i, j]) then
maxMain := A[i, j];
if (i + j = N + 1) and (maxSecond < A[i, j]) then
maxSecond := A[i, j];
end;
end;
writeln('Макс. на глав. диагонали: ' + maxMain);
writeln('Макс. на побочной. диагонали: ' + maxSecond);
end.
2)
const N = 10;
var A: array [1..N] of real;
B, C: array of real;
i: integer;
begin
write('A: ');
for i:= 1 to N do
begin
A[i]:=random(-10, 10);
write(A[i] + ' ');
end;
writeln();
for i:=1 to N do
begin
if (a[i] > 0) then
begin
SetLength(B, Length(B) + 1);
B[High(B)]:=a[i];
end;
if (a[i] < 0) then
begin
SetLength(C, Length(C) + 1);
C[High(C)]:=a[i];
end;
end;
write('B: ');
for i:= 0 to Length(B) - 1 do
write(B[i] + ' ');
writeln();
write('C: ');
for i:= 0 to Length(C) - 1 do
write(C[i] + ' ');
writeln();
end.