const
n=4;
var
a: array [1..n,1..n] of integer;
i,j,sum1,sum2: integer;
begin
sum1:=0; sum2:=0;
for i:=1 to n do
for j:=1 to n do
a[i,j]:=random(91)-45;
write(a[i,j]:4);
if i+j<i+i then
sum1:=sum1+a[i,j];
if i+j>n+1 then
sum2:=sum2+a[i,j];
end;
writeln;
writeln('L:',sum1, ' P:',sum2);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
const
n=4;
var
a: array [1..n,1..n] of integer;
i,j,sum1,sum2: integer;
begin
sum1:=0; sum2:=0;
for i:=1 to n do
begin
for j:=1 to n do
begin
a[i,j]:=random(91)-45;
write(a[i,j]:4);
if i+j<i+i then
sum1:=sum1+a[i,j];
if i+j>n+1 then
sum2:=sum2+a[i,j];
end;
writeln;
end;
writeln('L:',sum1, ' P:',sum2);
end.