var a:array[1..10,1..10]of integer; b:array[1..10,1..10]of integer; i,j,s1,s2:integer; begin for i:=1 to 10 do for j:=1 to 10 do begin a[i,j]:=random(9)+1; b[i,j]:=random(9)+1; end; for i:=1 to 10 do begin for j:=1 to 10 do write(a[i,j],' '); if j=10 then writeln; end; writeln; for i:=1 to 10 do begin for j:=1 to 10 do write(b[i,j],' '); if j=10 then writeln; end; for i:=1 to 10 do for j:=1 to 10 do if i=j then begin s1:=s1+a[i,j]; s2:=s2+b[i,j]; end; writeln; if s1>s2 then for i:=1 to 10 do begin for j:=1 to 10 do write(a[i,j],' '); if j=10 then writeln; end else for i:=1 to 10 do begin for j:=1 to 10 do write(b[i,j],' '); if j=10 then writeln; end; end.
var a:array[1..10,1..10]of integer;
b:array[1..10,1..10]of integer;
i,j,s1,s2:integer;
begin
for i:=1 to 10 do for j:=1 to 10 do begin a[i,j]:=random(9)+1; b[i,j]:=random(9)+1; end;
for i:=1 to 10 do begin for j:=1 to 10 do write(a[i,j],' '); if j=10 then writeln; end;
writeln;
for i:=1 to 10 do begin for j:=1 to 10 do write(b[i,j],' '); if j=10 then writeln; end;
for i:=1 to 10 do
for j:=1 to 10 do
if i=j then begin
s1:=s1+a[i,j];
s2:=s2+b[i,j];
end;
writeln;
if s1>s2 then for i:=1 to 10 do begin for j:=1 to 10 do write(a[i,j],' '); if j=10 then writeln; end else
for i:=1 to 10 do begin for j:=1 to 10 do write(b[i,j],' '); if j=10 then writeln; end;
end.