//Pascal ABC.NET Версия 2.2 Сборка 790 var ma:array[1..10,1..10] of integer; ar:array[1..10] of integer; i,j,s:integer; begin; randomize; writeln('Matrix:'); for i:=1 to 10 do begin; writeln; for j:=1 to 10 do begin; ma[i,j]:=random(-10,10); write(ma[i,j]:5); if ma[i,j]<0 then ar[i]+=ma[i,j]; end; end; writeln; writeln('Final array:'); for i:=1 to 10 do writeln(ar[i]); end.
var ma:array[1..10,1..10] of integer;
ar:array[1..10] of integer;
i,j,s:integer;
begin;
randomize;
writeln('Matrix:');
for i:=1 to 10 do
begin;
writeln;
for j:=1 to 10 do
begin;
ma[i,j]:=random(-10,10);
write(ma[i,j]:5);
if ma[i,j]<0 then ar[i]+=ma[i,j];
end;
end;
writeln;
writeln('Final array:');
for i:=1 to 10 do
writeln(ar[i]);
end.
Пример вывода:
Matrix:
9 -1 3 -10 6 3 -9 8 5 -6 -4 4 -6 7 7 7 -10 4 -2 3 -9 -3 10 -9 2 -7 1 -8 -8 -8 -5 -4 2 -5 -9 -9 3 6 7 -5 3 8 10 0 -9 4 -3 6 -10 -9 9 10 -8 1 -1 2 -1 1 -2 3 -8 10 5 3 10 -10 -8 9 6 6 -6 -5 8 -7 -10 -7 -2 -1 -10 9 7 5 -9 -10 -6 -5 -7 -9 7 -1 2 -9 -2 -6 -8 4 -7 -3 1 -9
Final array:
-26
-22
-52
-37
-31
-12
-26
-48
-47
-44