помогите составить программы в паскале в 2-х заданиях 5 вариант(в табличке13)
Answers & Comments
DeSex
Const n=6; m=8; var a,b,c:array[1..n,1..m]of integer; i,j,min,max:integer; begin for i:=1 to n do for j:=1 to m do begin a[i,j]:=i-j; b[i,j]:=sqr(i+j); c[i,j]:=a[i,j]+b[i,j]; end; writeln('A:'); for i:=1 to n do begin for j:=1 to m do write(a[i,j]:4); writeln; end; writeln('B:'); for i:=1 to n do begin for j:=1 to m do write(b[i,j]:4); writeln; end; min:=c[1,1] ; max:=min; writeln('C:'); for i:=1 to n do begin for j:=1 to m do begin write(c[i,j]:4); if c[i,j]<min then min:=c[i,j]; if c[i,j]>max then max:=c[i,j]; end; writeln; end; writeln('min=',min); writeln('max=',max); end.
Const n=6; m=8; var a:array[1..n,1..m]of integer; b:array[1..m,1..n]of integer; c:array[1..n,1..n]of integer; i,j,k,min,max:integer; begin writeln('A:'); for i:=1 to n do begin for j:=1 to m do begin a[i,j]:=sqr(i-j); write(a[i,j]:4); end; writeln; end; writeln('B:'); for i:=1 to m do begin for j:=1 to n do begin b[i,j]:=(i+j)*sqr(i+j); write(b[i,j]:5); end; writeln; end; writeln('C:'); for i:=1 to n do for j:=1 to n do for k:=1 to n do c[i,j]:=c[i,j]+a[i,k]*b[k,j]; min:=c[1,1]; max:=min; for i:=1 to n do begin for j:=1 to n do begin write(c[i,j]:6); if c[i,j]<min then min:=c[i,j]; if c[i,j]>max then max:=c[i,j]; end; writeln; end; writeln('min=',min); writeln('max=',max); end.
Answers & Comments
n=6;
m=8;
var
a,b,c:array[1..n,1..m]of integer;
i,j,min,max:integer;
begin
for i:=1 to n do
for j:=1 to m do
begin
a[i,j]:=i-j;
b[i,j]:=sqr(i+j);
c[i,j]:=a[i,j]+b[i,j];
end;
writeln('A:');
for i:=1 to n do
begin
for j:=1 to m do
write(a[i,j]:4);
writeln;
end;
writeln('B:');
for i:=1 to n do
begin
for j:=1 to m do
write(b[i,j]:4);
writeln;
end;
min:=c[1,1] ;
max:=min;
writeln('C:');
for i:=1 to n do
begin
for j:=1 to m do
begin
write(c[i,j]:4);
if c[i,j]<min then min:=c[i,j];
if c[i,j]>max then max:=c[i,j];
end;
writeln;
end;
writeln('min=',min);
writeln('max=',max);
end.
Const
n=6;
m=8;
var
a:array[1..n,1..m]of integer;
b:array[1..m,1..n]of integer;
c:array[1..n,1..n]of integer;
i,j,k,min,max:integer;
begin
writeln('A:');
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=sqr(i-j);
write(a[i,j]:4);
end;
writeln;
end;
writeln('B:');
for i:=1 to m do
begin
for j:=1 to n do
begin
b[i,j]:=(i+j)*sqr(i+j);
write(b[i,j]:5);
end;
writeln;
end;
writeln('C:');
for i:=1 to n do
for j:=1 to n do
for k:=1 to n do
c[i,j]:=c[i,j]+a[i,k]*b[k,j];
min:=c[1,1];
max:=min;
for i:=1 to n do
begin
for j:=1 to n do
begin
write(c[i,j]:6);
if c[i,j]<min then min:=c[i,j];
if c[i,j]>max then max:=c[i,j];
end;
writeln;
end;
writeln('min=',min);
writeln('max=',max);
end.