// PascalABC.NET 3.0, сборка 1073 const m=5; n=4; a:array[1..m] of real=(2,-7.1,3.2,-5.4,6.9); b:array[1..n] of real=(8.1,3.2,-6.4,-3.5); k=3; var i,j:integer; sk:real; s:array[1..m,1..n] of real; begin Writeln('Массив S'); for i:=1 to m do begin for j:=1 to n do begin s[i,j]:=a[i]*b[j]; Write(s[i,j]:7:2) end; Writeln end; sk:=0; for i:=1 to m do sk:=sk+s[i,k]; Writeln('Сумма элементов столбца ',k,' равна ',sk) end.
Результат выполнения программы: Массив S 16.20 6.40 -12.80 -7.00 -57.51 -22.72 45.44 24.85 25.92 10.24 -20.48 -11.20 -43.74 -17.28 34.56 18.90 55.89 22.08 -44.16 -24.15 Сумма элементов столбца 3 равна 2.56
2) const N=8; M=10; var p:array[1..N,1..M] of integer; i,j:integer; begin for i:= 1 to N do for j:=1 to M do begin p[i,j]:=i*j; write(p[i,j],' ') end; end.
3) const N=4; M=6; var z:array[1..N,1..M] of integer; i,j,sum,pr:integer; begin randomize;sum:=0; pr:=1; for i:= 1 to N do for j:=1 to M do begin z[i,j]:=random(100); write(z[i,j],' '); sum:=sum+z[i,j]; pr:=pr*z[i,j]; end; writeln(); write('сумма ',sum,' произведение ',pr); end.
4) const N=5; M=5; var a:array[1..N,1..M] of integer; i,j,sum,pr:integer; begin randomize; sum:=0; pr:=1; for i:= 1 to N do for j:=1 to M do begin a[i,j]:=random(100); write(a[i,j],' '); sum:=sum+a[i,j]; pr:=pr*a[i,j]; end; writeln(); write('сумма ',sum,' произведение ',pr); end.
const
m=5;
n=4;
a:array[1..m] of real=(2,-7.1,3.2,-5.4,6.9);
b:array[1..n] of real=(8.1,3.2,-6.4,-3.5);
k=3;
var
i,j:integer;
sk:real;
s:array[1..m,1..n] of real;
begin
Writeln('Массив S');
for i:=1 to m do begin
for j:=1 to n do begin
s[i,j]:=a[i]*b[j];
Write(s[i,j]:7:2)
end;
Writeln
end;
sk:=0;
for i:=1 to m do sk:=sk+s[i,k];
Writeln('Сумма элементов столбца ',k,' равна ',sk)
end.
Результат выполнения программы:
Массив S
16.20 6.40 -12.80 -7.00
-57.51 -22.72 45.44 24.85
25.92 10.24 -20.48 -11.20
-43.74 -17.28 34.56 18.90
55.89 22.08 -44.16 -24.15
Сумма элементов столбца 3 равна 2.56
const
N=8;
M=10;
var p:array[1..N,1..M] of integer;
i,j:integer;
begin
for i:= 1 to N do
for j:=1 to M do
begin p[i,j]:=i*j; write(p[i,j],' ')
end;
end.
3)
const
N=4;
M=6;
var z:array[1..N,1..M] of integer;
i,j,sum,pr:integer;
begin
randomize;sum:=0;
pr:=1;
for i:= 1 to N do
for j:=1 to M do
begin z[i,j]:=random(100);
write(z[i,j],' ');
sum:=sum+z[i,j];
pr:=pr*z[i,j];
end;
writeln();
write('сумма ',sum,' произведение ',pr);
end.
4)
const
N=5;
M=5;
var a:array[1..N,1..M] of integer;
i,j,sum,pr:integer;
begin
randomize;
sum:=0;
pr:=1;
for i:= 1 to N do
for j:=1 to M do
begin
a[i,j]:=random(100);
write(a[i,j],' ');
sum:=sum+a[i,j];
pr:=pr*a[i,j];
end;
writeln();
write('сумма ',sum,' произведение ',pr);
end.