Дана матрица размера M×N. Вывести ее элементы в следующем порядке: первая строка слева направо, вторая строка справа налево, третья строка слева направо, четвертая строка справа налево и т.д. с
Program gt2; var i,j,s:integer; a:array[1..4,1..4]of integer; begin randomize; for i:=1 to 4 do for j:=1 to 4 do a[i,j]:=random(7)+12; for i:=1 to 4 do begin s:=0; for j:=1 to 4 do s:=s+a[j,i]; writeln(s); end; end.
program gt3; var i,j,s:integer; a:array[1..7,1..7]of integer; begin randomize; for i:=1 to 7 do for j:=1 to 7 do a[i,j]:=random(7)+12; for i:=1 to 7 do begin s:=0; for j:=1 to 7 do if(a[j,i]<14)then s:=s+1; writeln(s); end; end.
program gt4; var i,j,p:integer; a:array[1..3,1..3]of integer; begin for i:=1 to 3 do for j:=1 to 3 do read(a[i,j]); for i:=1 to 3 do begin p:=a[i,1]; a[i,1]:=a[i,2]; a[i,2]:=p; end; for i:=1 to 3 do begin for j:=1 to 3 do begin write(a[i,j],' '); end; writeln; end; end.
VAR i, j: Integer; a: Array [1..10] of Array [1..10] of Integer; BEGIN for i := 1 to 10 do for j := 1 to 10 do a[i][j] := j*j;
for i := 1 to 10 do begin for j := 1 to 10 do Write(a[i][j],' '); Writeln; end; END.
VAR i, j: Integer; a: Array [0..4] of Array [1..4] of Integer; BEGIN for i := 1 to 4 do for j := 1 to 4 do begin a[i][j] := Random(7)+12; a[0][j] := a[0][j] + a[i][j]; end;
for i := 1 to 4 do begin for j := 1 to 4 do Write(a[i][j],' '); Writeln; end;
Writeln; for i := 1 to 4 do Write(a[0][i],' '); END.
VAR i, j: Integer; a: Array [0..7] of Array [1..7] of Integer; BEGIN for i := 1 to 7 do for j := 1 to 7 do begin a[i][j] := Random(7)+12; if (a[i][j] < 14) then Inc(a[0][j]); end;
for i := 1 to 7 do begin for j := 1 to 7 do Write(a[i][j],' '); Writeln; end;
Writeln; for i := 1 to 7 do Write(a[0][i],' '); END.
VAR i, j: Integer; a: Array [0..3] of Array [1..3] of Integer; BEGIN for i := 1 to 3 do for j := 1 to 3 do Read(a[i][j]);
for i := 1 to 3 do begin a[0][i] := a[1][i]; a[1][i] := a[2][i]; a[2][i] := a[0][i]; end;
for i := 1 to 3 do begin for j := 1 to 3 do Write(a[i][j],' '); Writeln; end; END.
VAR i, j, m: Integer; a: Array [1..5] of Array [1..5] of Integer; BEGIN for i := 1 to 5 do for j := 1 to 5 do begin a[i][j] := Random(5)+1; end;
for i := 1 to 5 do begin for j := 1 to 5 do Write(a[i][j],' '); Writeln; end;
m := 6; for i := 1 to 5 do for j := 1 to 5 do if (i > j)and(m > a[i][j]) then m := a[i][j];
var i,j,s:integer;
a:array[1..4,1..4]of integer;
begin
randomize;
for i:=1 to 4 do
for j:=1 to 4 do
a[i,j]:=random(7)+12;
for i:=1 to 4 do
begin
s:=0;
for j:=1 to 4 do
s:=s+a[j,i];
writeln(s);
end;
end.
program gt3;
var i,j,s:integer;
a:array[1..7,1..7]of integer;
begin
randomize;
for i:=1 to 7 do
for j:=1 to 7 do
a[i,j]:=random(7)+12;
for i:=1 to 7 do
begin
s:=0;
for j:=1 to 7 do
if(a[j,i]<14)then s:=s+1;
writeln(s);
end;
end.
program gt4;
var i,j,p:integer;
a:array[1..3,1..3]of integer;
begin
for i:=1 to 3 do
for j:=1 to 3 do
read(a[i,j]);
for i:=1 to 3 do
begin
p:=a[i,1];
a[i,1]:=a[i,2];
a[i,2]:=p;
end;
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
write(a[i,j],' ');
end;
writeln;
end;
end.
i, j: Integer;
a: Array [1..10] of Array [1..10] of Integer;
BEGIN
for i := 1 to 10 do
for j := 1 to 10 do a[i][j] := j*j;
for i := 1 to 10 do begin
for j := 1 to 10 do Write(a[i][j],' '); Writeln; end;
END.
VAR
i, j: Integer;
a: Array [0..4] of Array [1..4] of Integer;
BEGIN
for i := 1 to 4 do
for j := 1 to 4 do begin
a[i][j] := Random(7)+12;
a[0][j] := a[0][j] + a[i][j];
end;
for i := 1 to 4 do begin
for j := 1 to 4 do Write(a[i][j],' '); Writeln; end;
Writeln;
for i := 1 to 4 do Write(a[0][i],' ');
END.
VAR
i, j: Integer;
a: Array [0..7] of Array [1..7] of Integer;
BEGIN
for i := 1 to 7 do
for j := 1 to 7 do begin
a[i][j] := Random(7)+12;
if (a[i][j] < 14) then Inc(a[0][j]);
end;
for i := 1 to 7 do begin
for j := 1 to 7 do Write(a[i][j],' '); Writeln; end;
Writeln;
for i := 1 to 7 do Write(a[0][i],' ');
END.
VAR
i, j: Integer;
a: Array [0..3] of Array [1..3] of Integer;
BEGIN
for i := 1 to 3 do
for j := 1 to 3 do Read(a[i][j]);
for i := 1 to 3 do begin
a[0][i] := a[1][i]; a[1][i] := a[2][i];
a[2][i] := a[0][i]; end;
for i := 1 to 3 do begin
for j := 1 to 3 do Write(a[i][j],' '); Writeln; end;
END.
VAR
i, j, m: Integer;
a: Array [1..5] of Array [1..5] of Integer;
BEGIN
for i := 1 to 5 do
for j := 1 to 5 do begin
a[i][j] := Random(5)+1;
end;
for i := 1 to 5 do begin
for j := 1 to 5 do Write(a[i][j],' '); Writeln; end;
m := 6;
for i := 1 to 5 do
for j := 1 to 5 do
if (i > j)and(m > a[i][j]) then m := a[i][j];
Writeln(a[i][j]);
END.