procedure MatrA(var a: mass); var i, j: integer; begin for i := 1 to n do for j := 1 to m do begin writeln('a[', i, ',', j, ']: '); readln(a[i, j]) end end;
procedure MatrB(var b: mass); var i, j: integer; begin for i := 1 to n1 do for j := 1 to m1 do begin writeln('b[', i, ',', j, ']: '); readln(b[i, j]) end end;
procedure Sum(a, b: mass; var c: mass); var i, j: integer; begin for i := 1 to n do for j := 1 to m do c[i, j] := a[i, j] + b[i, j]; end;
begin writeln('Введите n,m матрицы A'); readln(n, m); MatrA(a); writeln('Введите n,m матрицы B'); readln(n1, m1); MatrB(b); if (n1 <> n) and (m1 <> m) then writeln('Матрицы сложить нельзя') else begin Sum(a, b, c); writeln('A+B'); for i := 1 to n do begin for j := 1 to m do write(c[i, j]:1:3, ' '); writeln end end; readln; end.
diannaevaaa
27.08.2021
Вот программа : program xxx; <p>program xxx;</p><p> var i, k, d, e, s : integer;</p><p>begin</p><p> k:=0;</p><p> for i:= 10 to 99 do</p><p> begin</p><p> d:= i div 10;</p><p> e:= i mod 10;</p><p> s:=d + e;</p><p> if i mod s = 0 then k:=k+1</p><p> end;</p><p> write ('кол-во чисел которые делятся на сумму своих цифр=', k);</p><p> readln</p><p>end.</p>
mass = array[1..10, 1..10] of real;
var
a, b, c: mass;
n, m, i, j, n1, m1: integer;
procedure MatrA(var a: mass);
var
i, j: integer;
begin
for i := 1 to n do
for j := 1 to m do
begin
writeln('a[', i, ',', j, ']: ');
readln(a[i, j])
end
end;
procedure MatrB(var b: mass);
var
i, j: integer;
begin
for i := 1 to n1 do
for j := 1 to m1 do
begin
writeln('b[', i, ',', j, ']: ');
readln(b[i, j])
end
end;
procedure Sum(a, b: mass; var c: mass);
var
i, j: integer;
begin
for i := 1 to n do
for j := 1 to m do
c[i, j] := a[i, j] + b[i, j];
end;
begin
writeln('Введите n,m матрицы A');
readln(n, m);
MatrA(a);
writeln('Введите n,m матрицы B');
readln(n1, m1);
MatrB(b);
if (n1 <> n) and (m1 <> m) then
writeln('Матрицы сложить нельзя')
else begin
Sum(a, b, c);
writeln('A+B');
for i := 1 to n do
begin
for j := 1 to m do
write(c[i, j]:1:3, ' ');
writeln
end
end;
readln;
end.