Const
nn=30;
mm=30;
var
m,n,i,j:integer;
s:longint;
a:array[1..mm,1..nn] of integer;
begin
Randomize;
Read(m,n);
s:=0;
for i:=1 to m do begin
for j:=1 to n do begin
a[i,j]:=Random(101)-50;
Write(a[i,j]:4);
s:=a[i,j]*Sqr(a[i,j])
end;
Writeln
end;
Writeln('Сумма кубов равна ',s)
end.
Пример
4 5
21 -47 -14 -24 -40
34 -49 45 -21 -49
-34 -21 25 41 -46
-44 49 -10 2 14
Сумма кубов равна 2744